diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000000..4f8a62b142 --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +/target +**/*.rs.bk +**/target +Cargo.lock +**/Cargo.lock diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000000..b7a10d0ad8 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,33 @@ +# Copyright (c) 2019 Ant Financial +# +# SPDX-License-Identifier: Apache-2.0 +# + +sudo: required +dist: bionic + +os: + - linux + +language: rust +rust: + - nightly + +env: + - target_branch=$TRAVIS_BRANCH RUST_AGENT=yes + +before_install: + - "ci/setup.sh" + - "ci/install_go.sh" + - "ci/install_rust.sh" + - "ci/static-checks.sh" + +# need to install rust from scratch? +# still need go to download github.com/kata-containers/tests +# which is already installed? + +install: + - cd ${TRAVIS_BUILD_DIR}/src/agent && make + +script: + - cd ${TRAVIS_BUILD_DIR}/src/agent && make check diff --git a/ci/install_go.sh b/ci/install_go.sh new file mode 100755 index 0000000000..d8ec8cf67d --- /dev/null +++ b/ci/install_go.sh @@ -0,0 +1,22 @@ +#!/bin/bash +# +# Copyright (c) 2019 Intel Corporation +# +# SPDX-License-Identifier: Apache-2.0 + +set -e + +cidir=$(dirname "$0") +source "${cidir}/lib.sh" + +clone_tests_repo + +new_goroot=/usr/local/go + +pushd "${tests_repo_dir}" +# Force overwrite the current version of golang +[ -z "${GOROOT}" ] || rm -rf "${GOROOT}" +.ci/install_go.sh -p -f -d "$(dirname ${new_goroot})" +[ -z "${GOROOT}" ] || sudo ln -sf "${new_goroot}" "${GOROOT}" +go version +popd diff --git a/ci/install_rust.sh b/ci/install_rust.sh new file mode 100755 index 0000000000..4e2def198d --- /dev/null +++ b/ci/install_rust.sh @@ -0,0 +1,16 @@ +#!/bin/bash +# Copyright (c) 2019 Ant Financial +# +# SPDX-License-Identifier: Apache-2.0 +# + +set -e + +cidir=$(dirname "$0") +source "${cidir}/lib.sh" + +clone_tests_repo + +pushd ${tests_repo_dir} +.ci/install_rust.sh +popd diff --git a/ci/lib.sh b/ci/lib.sh new file mode 100644 index 0000000000..2b69144ce0 --- /dev/null +++ b/ci/lib.sh @@ -0,0 +1,35 @@ +# +# Copyright (c) 2018 Intel Corporation +# +# SPDX-License-Identifier: Apache-2.0 + +export tests_repo="${tests_repo:-github.com/kata-containers/tests}" +export tests_repo_dir="$GOPATH/src/$tests_repo" + +clone_tests_repo() +{ + # KATA_CI_NO_NETWORK is (has to be) ignored if there is + # no existing clone. + if [ -d "$tests_repo_dir" -a -n "$KATA_CI_NO_NETWORK" ] + then + return + fi + + go get -d -u "$tests_repo" || true + + if [ -n "${TRAVIS_BRANCH:-}" ]; then + ( cd "${tests_repo_dir}" && git checkout "${TRAVIS_BRANCH}" ) + fi +} + +run_static_checks() +{ + clone_tests_repo + bash "$tests_repo_dir/.ci/static-checks.sh" "github.com/kata-containers/kata-containers" +} + +run_rust_test() +{ + clone_tests_repo + bash "$tests_repo_dir/.ci/rust-test.sh" +} diff --git a/ci/run.sh b/ci/run.sh new file mode 100755 index 0000000000..90749b86bf --- /dev/null +++ b/ci/run.sh @@ -0,0 +1,16 @@ +#!/bin/bash +# +# Copyright (c) 2019 Ant Financial +# +# SPDX-License-Identifier: Apache-2.0 +# + +set -e +cidir=$(dirname "$0") +source "${cidir}/lib.sh" + +clone_tests_repo + +pushd ${tests_repo_dir} +.ci/run.sh +popd diff --git a/ci/setup.sh b/ci/setup.sh new file mode 100755 index 0000000000..8580fb7352 --- /dev/null +++ b/ci/setup.sh @@ -0,0 +1,16 @@ +#!/bin/bash +# +# Copyright (c) 2018 Intel Corporation +# +# SPDX-License-Identifier: Apache-2.0 + +set -e + +cidir=$(dirname "$0") +source "${cidir}/lib.sh" + +clone_tests_repo + +pushd "${tests_repo_dir}" +.ci/setup.sh +popd diff --git a/ci/static-checks.sh b/ci/static-checks.sh new file mode 100755 index 0000000000..f2e5f8ca74 --- /dev/null +++ b/ci/static-checks.sh @@ -0,0 +1,13 @@ +#!/bin/bash +# +# Copyright (c) 2017-2018 Intel Corporation +# +# SPDX-License-Identifier: Apache-2.0 + +set -e + +cidir=$(dirname "$0") +source "${cidir}/lib.sh" + +cd ${TRAVIS_BUILD_DIR}/src/agent +run_static_checks diff --git a/src/agent/Cargo.toml b/src/agent/Cargo.toml new file mode 100644 index 0000000000..8050d02ce2 --- /dev/null +++ b/src/agent/Cargo.toml @@ -0,0 +1,32 @@ +[package] +name = "kata-agent" +version = "0.1.0" +authors = ["Yang Bo "] +edition = "2018" + +[dependencies] +oci = { path = "oci" } +rustjail = { path = "rustjail" } +protocols = { path = "protocols" } +lazy_static = "1.3.0" +error-chain = "0.12.1" +grpcio = { git="https://github.com/alipay/grpc-rs", branch="rust_agent" } +protobuf = "2.6.1" +futures = "0.1.27" +libc = "0.2.58" +nix = "0.14.1" +prctl = "1.0.0" +serde_json = "1.0.39" +signal-hook = "0.1.9" +scan_fmt = "0.2.3" +regex = "1" +# slog: +# - Dynamic keys required to allow HashMap keys to be slog::Serialized. +# - The 'max_*' features allow changing the log level at runtime +# (by stopping the compiler from removing log calls). +slog = { version = "2.5.2", features = ["dynamic-keys", "max_level_trace", "release_max_level_info"] } +slog-json = "2.3.0" +slog-async = "2.3.0" +slog-scope = "4.1.2" +# for testing +tempfile = "3.1.0" diff --git a/src/agent/LICENSE b/src/agent/LICENSE new file mode 100644 index 0000000000..57bc88a15a --- /dev/null +++ b/src/agent/LICENSE @@ -0,0 +1,202 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + 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. + diff --git a/src/agent/Makefile b/src/agent/Makefile new file mode 100644 index 0000000000..6805d43da0 --- /dev/null +++ b/src/agent/Makefile @@ -0,0 +1,92 @@ +# Copyright (c) 2019 Intel Corporation +# +# SPDX-License-Identifier: Apache-2.0 +# + +PROJECT_NAME = Kata Containers +PROJECT_URL = https://github.com/kata-containers +PROJECT_COMPONENT = kata-agent + +TARGET = $(PROJECT_COMPONENT) + +SOURCES := \ + $(shell find . 2>&1 | grep -E '.*\.rs$$') \ + Cargo.toml + +VERSION_FILE := ./VERSION +VERSION := $(shell grep -v ^\# $(VERSION_FILE)) +COMMIT_NO := $(shell git rev-parse HEAD 2>/dev/null || true) +COMMIT_NO_SHORT := $(shell git rev-parse --short HEAD 2>/dev/null || true) +COMMIT := $(if $(shell git status --porcelain --untracked-files=no 2>/dev/null || true),${COMMIT_NO}-dirty,${COMMIT_NO}) +COMMIT_MSG = $(if $(COMMIT),$(COMMIT),unknown) + +# Exported to allow cargo to see it +export VERSION_COMMIT := $(if $(COMMIT),$(VERSION)-$(COMMIT),$(VERSION)) + +BUILD_TYPE = release + +ARCH = $(shell uname -m) +LIBC = musl +TRIPLE = $(ARCH)-unknown-linux-$(LIBC) + +TARGET_PATH = target/$(TRIPLE)/$(BUILD_TYPE)/$(TARGET) + +DESTDIR := +BINDIR := /usr/bin + +# Display name of command and it's version (or a message if not available). +# +# Arguments: +# +# 1: Name of command +define get_command_version +$(shell printf "%s: %s\\n" $(1) "$(or $(shell $(1) --version 2>/dev/null), (not available))") +endef + +define get_toolchain_version +$(shell printf "%s: %s\\n" "toolchain" "$(or $(shell rustup show active-toolchain 2>/dev/null), (unknown))") +endef + +default: $(TARGET) show-header + +$(TARGET): $(TARGET_PATH) + +$(TARGET_PATH): $(SOURCES) | show-summary + @cargo build --target $(TRIPLE) + +show-header: + @printf "%s - version %s (commit %s)\n\n" "$(TARGET)" "$(VERSION)" "$(COMMIT_MSG)" + +install: + @install -D $(TARGET_PATH) $(DESTDIR)/$(BINDIR)/$(TARGET) + +clean: + @cargo clean + +check: + @cargo test --target $(TRIPLE) + +run: + @cargo run --target $(TRIPLE) + +show-summary: show-header + @printf "project:\n" + @printf " name: $(PROJECT_NAME)\n" + @printf " url: $(PROJECT_URL)\n" + @printf " component: $(PROJECT_COMPONENT)\n" + @printf "target: $(TARGET)\n" + @printf "architecture:\n" + @printf " host: $(ARCH)\n" + @printf "rust:\n" + @printf " %s\n" "$(call get_command_version,cargo)" + @printf " %s\n" "$(call get_command_version,rustc)" + @printf " %s\n" "$(call get_command_version,rustup)" + @printf " %s\n" "$(call get_toolchain_version)" + @printf "\n" + +help: show-summary + +.PHONY: \ + help \ + show-header \ + show-summary diff --git a/src/agent/README.md b/src/agent/README.md new file mode 100644 index 0000000000..bb4b49790b --- /dev/null +++ b/src/agent/README.md @@ -0,0 +1,69 @@ +# Kata Agent in Rust + +This is a rust version of the [`kata-agent`](https://github.com/kata-containers/kata-agent). + +In Denver PTG, [we discussed about re-writing agent in rust](https://etherpad.openstack.org/p/katacontainers-2019-ptg-denver-agenda): + +> In general, we all think about re-write agent in rust to reduce the footprint of agent. Moreover, Eric mentioned the possibility to stop using gRPC, which may have some impact on footprint. We may begin to do some PoC to show how much we could save by re-writing agent in rust. + +After that, we drafted the initial code here, and any contributions are welcome. + +## Features + +| Feature | Status | +| :--|:--:| +| **OCI Behaviors** | +| create/start containers | :white_check_mark: | +| signal/wait process | :white_check_mark: | +| exec/list process | :white_check_mark: | +| I/O stream | :white_check_mark: | +| Cgroups | :white_check_mark: | +| Capabilities, rlimit, readonly path, masked path, users | :white_check_mark: | +| container stats (`stats_container`) | :white_check_mark: | +| Hooks | :white_check_mark: | +| **Agent Features & APIs** | +| run agent as `init` (mount fs, udev, setup `lo`) | :white_check_mark: | +| block device as root device | :white_check_mark: | +| Health API | :white_check_mark: | +| network, interface/routes (`update_container`) | :white_check_mark: | +| File transfer API (`copy_file`) | :white_check_mark: | +| Device APIs (`reseed_random_device`, , `online_cpu_memory`, `mem_hotplug_probe`, `set_guet_data_time`) | :white_check_mark: | +| vsock support | :white_check_mark: | +| virtio-serial support | :heavy_multiplication_x: | +| OCI Spec validator | :white_check_mark: | +| **Infrastructures**| +| Debug Console | :white_check_mark: | +| Command line | :white_check_mark: | +| Tracing | :heavy_multiplication_x: | + +## Getting Started + +### Dependencies +The `rust-agent` depends on [`grpc-rs`](https://github.com/pingcap/grpc-rs) by PingCAP. However, the upstream `grpc-rs` and [gRPC](https://github.com/grpc/grpc) need some changes to be used here, which may take some time to be landed. Therefore, we created a temporary fork or `grpc-rs` here: +- https://github.com/alipay/grpc-rs/tree/rust_agent + +### Build from Source +The rust-agent need to be built with rust nightly, and static linked with musl. +```bash +rustup toolchain install nightly +rustup default nightly +rustup target add x86_64-unknown-linux-musl --toolchain=nightly +git submodule update --init --recursive +sudo ln -s /usr/bin/g++ /bin/musl-g++ +cargo build --target x86_64-unknown-linux-musl --release +``` + +## Run Kata CI with rust-agent + * Firstly, install kata as noted by ["how to install Kata"](https://github.com/kata-containers/documentation/blob/master/install/README.md) + * Secondly, build your own kata initrd/image following the steps in ["how to build your own initrd/image"](https://github.com/kata-containers/documentation/blob/master/Developer-Guide.md#create-and-install-rootfs-and-initrd-image). +notes: Please use your rust agent instead of the go agent when building your initrd/image. + * Clone the kata ci test cases from: https://github.com/kata-containers/tests.git, and then run the cri test with: + +```bash +$sudo -E PATH=$PATH -E GOPATH=$GOPATH integration/containerd/shimv2/shimv2-tests.sh +``` + +## Mini Benchmark +The memory of 'RssAnon' consumed by the go-agent and rust-agent as below: +go-agent: about 11M +rust-agent: about 1.1M diff --git a/src/agent/VERSION b/src/agent/VERSION new file mode 100644 index 0000000000..8acdd82b76 --- /dev/null +++ b/src/agent/VERSION @@ -0,0 +1 @@ +0.0.1 diff --git a/src/agent/oci/Cargo.toml b/src/agent/oci/Cargo.toml new file mode 100644 index 0000000000..2ccf13a9af --- /dev/null +++ b/src/agent/oci/Cargo.toml @@ -0,0 +1,11 @@ +[package] +name = "oci" +version = "0.1.0" +authors = ["Yang Bo "] +edition = "2018" + +[dependencies] +serde = "1.0.91" +serde_derive = "1.0.91" +serde_json = "1.0.39" +libc = "0.2.58" diff --git a/src/agent/oci/src/lib.rs b/src/agent/oci/src/lib.rs new file mode 100644 index 0000000000..011d71502e --- /dev/null +++ b/src/agent/oci/src/lib.rs @@ -0,0 +1,850 @@ +// Copyright (c) 2019 Ant Financial +// +// SPDX-License-Identifier: Apache-2.0 +// + +extern crate serde; +#[macro_use] +extern crate serde_derive; +extern crate serde_json; + +use std::collections::HashMap; +// use std::io::Write; +use libc::mode_t; +// use std::any::Any; + +pub mod serialize; + +#[allow(dead_code)] +fn is_false(b: bool) -> bool { + !b +} + +#[allow(dead_code)] +fn is_default(d: &T) -> bool +where + T: Default + PartialEq, +{ + *d == T::default() +} + +#[derive(Serialize, Deserialize, Debug)] +pub struct Spec { + #[serde( + default, + rename = "ociVersion", + skip_serializing_if = "String::is_empty" + )] + pub version: String, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub process: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub root: Option, + #[serde(default, skip_serializing_if = "String:: is_empty")] + pub hostname: String, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub mounts: Vec, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub hooks: Option, + #[serde(default, skip_serializing_if = "HashMap::is_empty")] + pub annotations: HashMap, + #[serde(skip_serializing_if = "Option::is_none")] + pub linux: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub solaris: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub windows: Option>, + #[serde(skip_serializing_if = "Option::is_none")] + pub vm: Option, +} + +impl Spec { + pub fn load(path: &str) -> Result { + serialize::deserialize(path) + } + + pub fn save(&self, path: &str) -> Result<(), serialize::SerializeError> { + serialize::serialize(self, path) + } +} + +#[allow(dead_code)] +pub type LinuxRlimit = POSIXRlimit; + +#[derive(Serialize, Deserialize, Debug)] +pub struct Process { + #[serde(default)] + pub terminal: bool, + #[serde( + default, + rename = "consoleSize", + skip_serializing_if = "Option::is_none" + )] + pub console_size: Option, + pub user: User, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub args: Vec, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub env: Vec, + #[serde(default, skip_serializing_if = "String::is_empty")] + pub cwd: String, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub capabilities: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub rlimits: Vec, + #[serde(default, rename = "noNewPrivileges")] + pub no_new_privileges: bool, + #[serde( + default, + rename = "apparmorProfile", + skip_serializing_if = "String::is_empty" + )] + pub apparmor_profile: String, + #[serde( + default, + rename = "oomScoreAdj", + skip_serializing_if = "Option::is_none" + )] + pub oom_score_adj: Option, + #[serde( + default, + rename = "selinuxLabel", + skip_serializing_if = "String::is_empty" + )] + pub selinux_label: String, +} + +#[derive(Serialize, Deserialize, Debug)] +pub struct LinuxCapabilities { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub bounding: Vec, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub effective: Vec, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub inheritable: Vec, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub permitted: Vec, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub ambient: Vec, +} + +#[derive(Default, PartialEq, Serialize, Deserialize, Debug)] +pub struct Box { + #[serde(default)] + pub height: u32, + #[serde(default)] + pub width: u32, +} + +#[derive(Serialize, Deserialize, Debug)] +pub struct User { + #[serde(default)] + pub uid: u32, + #[serde(default)] + pub gid: u32, + #[serde( + default, + rename = "addtionalGids", + skip_serializing_if = "Vec::is_empty" + )] + pub additional_gids: Vec, + #[serde(default, skip_serializing_if = "String::is_empty")] + pub username: String, +} + +#[derive(Serialize, Deserialize, Debug)] +pub struct Root { + #[serde(default, skip_serializing_if = "String::is_empty")] + pub path: String, + #[serde(default)] + pub readonly: bool, +} + +#[derive(Serialize, Deserialize, Debug)] +pub struct Mount { + #[serde(default)] + pub destination: String, + #[serde(default, skip_serializing_if = "String::is_empty")] + pub r#type: String, + #[serde(default, skip_serializing_if = "String::is_empty")] + pub source: String, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub options: Vec, +} + +#[derive(Serialize, Deserialize, Debug)] +pub struct Hook { + #[serde(default, skip_serializing_if = "String::is_empty")] + pub path: String, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub args: Vec, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub env: Vec, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub timeout: Option, +} + +#[derive(Serialize, Deserialize, Debug)] +pub struct Hooks { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub prestart: Vec, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub poststart: Vec, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub poststop: Vec, +} + +#[derive(Serialize, Deserialize, Debug)] +pub struct Linux { + #[serde(default, rename = "uidMappings", skip_serializing_if = "Vec::is_empty")] + pub uid_mappings: Vec, + #[serde(default, rename = "gidMappings", skip_serializing_if = "Vec::is_empty")] + pub gid_mappings: Vec, + #[serde(default, skip_serializing_if = "HashMap::is_empty")] + pub sysctl: HashMap, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub resources: Option, + #[serde( + default, + rename = "cgroupsPath", + skip_serializing_if = "String::is_empty" + )] + pub cgroups_path: String, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub namespaces: Vec, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub devices: Vec, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub seccomp: Option, + #[serde( + default, + rename = "rootfsPropagation", + skip_serializing_if = "String::is_empty" + )] + pub rootfs_propagation: String, + #[serde(default, rename = "maskedPaths", skip_serializing_if = "Vec::is_empty")] + pub masked_paths: Vec, + #[serde( + default, + rename = "readonlyPaths", + skip_serializing_if = "Vec::is_empty" + )] + pub readonly_paths: Vec, + #[serde( + default, + rename = "mountLabel", + skip_serializing_if = "String::is_empty" + )] + pub mount_label: String, + #[serde(default, rename = "intelRdt", skip_serializing_if = "Option::is_none")] + pub intel_rdt: Option, +} + +#[derive(Serialize, Deserialize, Debug)] +pub struct LinuxNamespace { + #[serde(default, skip_serializing_if = "String::is_empty")] + pub r#type: LinuxNamespaceType, + #[serde(default, skip_serializing_if = "String::is_empty")] + pub path: String, +} + +pub type LinuxNamespaceType = String; + +#[allow(dead_code)] +pub const PIDNAMESPACE: &'static str = "pid"; +#[allow(dead_code)] +pub const NETWORKNAMESPACE: &'static str = "network"; +#[allow(dead_code)] +pub const MOUNTNAMESPACE: &'static str = "mount"; +#[allow(dead_code)] +pub const IPCNAMESPACE: &'static str = "ipc"; +#[allow(dead_code)] +pub const USERNAMESPACE: &'static str = "user"; +#[allow(dead_code)] +pub const UTSNAMESPACE: &'static str = "uts"; +#[allow(dead_code)] +pub const CGROUPNAMESPACE: &'static str = "cgroup"; + +#[derive(Serialize, Deserialize, Debug)] +pub struct LinuxIDMapping { + #[serde(default, rename = "containerID")] + pub container_id: u32, + #[serde(default, rename = "hostID")] + pub host_id: u32, + #[serde(default)] + pub size: u32, +} + +#[derive(Serialize, Deserialize, Debug)] +pub struct POSIXRlimit { + #[serde(default)] + pub r#type: String, + #[serde(default)] + pub hard: u64, + #[serde(default)] + pub soft: u64, +} + +#[derive(Serialize, Deserialize, Debug)] +pub struct LinuxHugepageLimit { + #[serde(default, rename = "pageSize", skip_serializing_if = "String::is_empty")] + pub page_size: String, + #[serde(default)] + pub limit: u64, +} + +#[derive(Serialize, Deserialize, Debug)] +pub struct LinuxInterfacePriority { + #[serde(default, skip_serializing_if = "String::is_empty")] + pub name: String, + #[serde(default)] + pub priority: u32, +} + +#[derive(Serialize, Deserialize, Debug)] +pub struct LinuxBlockIODevice { + #[serde(default)] + pub major: i64, + #[serde(default)] + pub minor: i64, +} + +#[derive(Serialize, Deserialize, Debug)] +pub struct LinuxWeightDevice { + pub blk: LinuxBlockIODevice, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub weight: Option, + #[serde( + default, + rename = "leafWeight", + skip_serializing_if = "Option::is_none" + )] + pub leaf_weight: Option, +} + +#[derive(Serialize, Deserialize, Debug)] +pub struct LinuxThrottleDevice { + pub blk: LinuxBlockIODevice, + #[serde(default)] + pub rate: u64, +} + +#[derive(Serialize, Deserialize, Debug)] +pub struct LinuxBlockIO { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub weight: Option, + #[serde( + default, + rename = "leafWeight", + skip_serializing_if = "Option::is_none" + )] + pub leaf_weight: Option, + #[serde( + default, + rename = "weightDevice", + skip_serializing_if = "Vec::is_empty" + )] + pub weight_device: Vec, + #[serde( + default, + skip_serializing_if = "Vec::is_empty", + rename = "throttleReadBpsDevice" + )] + pub throttle_read_bps_device: Vec, + #[serde( + default, + skip_serializing_if = "Vec::is_empty", + rename = "throttleWriteBpsDevice" + )] + pub throttle_write_bps_device: Vec, + #[serde( + default, + skip_serializing_if = "Vec::is_empty", + rename = "throttleReadIOPSDevice" + )] + pub throttle_read_iops_device: Vec, + #[serde( + default, + skip_serializing_if = "Vec::is_empty", + rename = "throttleWriteIOPSDevice" + )] + pub throttle_write_iops_device: Vec, +} + +#[derive(Serialize, Deserialize, Debug)] +pub struct LinuxMemory { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub limit: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub reservation: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub swap: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub kernel: Option, + #[serde(default, skip_serializing_if = "Option::is_none", rename = "kernelTCP")] + pub kernel_tcp: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub swapiness: Option, + #[serde( + default, + skip_serializing_if = "Option::is_none", + rename = "disableOOMKiller" + )] + pub disable_oom_killer: Option, +} + +#[derive(Serialize, Deserialize, Debug)] +pub struct LinuxCPU { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub shares: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub quota: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub period: Option, + #[serde( + default, + skip_serializing_if = "Option::is_none", + rename = "realtimeRuntime" + )] + pub realtime_runtime: Option, + #[serde( + default, + skip_serializing_if = "Option::is_none", + rename = "realtimePeriod" + )] + pub realtime_period: Option, + #[serde(default, skip_serializing_if = "String::is_empty")] + pub cpus: String, + #[serde(default, skip_serializing_if = "String::is_empty")] + pub mems: String, +} + +#[derive(Serialize, Deserialize, Debug)] +pub struct LinuxPids { + #[serde(default)] + pub limit: i64, +} + +#[derive(Serialize, Deserialize, Debug)] +pub struct LinuxNetwork { + #[serde(default, skip_serializing_if = "Option::is_none", rename = "classID")] + pub class_id: Option, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub priorities: Vec, +} + +#[derive(Serialize, Deserialize, Debug)] +pub struct LinuxRdma { + #[serde( + default, + skip_serializing_if = "Option::is_none", + rename = "hcaHandles" + )] + pub hca_handles: Option, + #[serde( + default, + skip_serializing_if = "Option::is_none", + rename = "hcaObjects" + )] + pub hca_objects: Option, +} + +#[derive(Serialize, Deserialize, Debug)] +pub struct LinuxResources { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub devices: Vec, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub memory: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub cpu: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub pids: Option, + #[serde(skip_serializing_if = "Option::is_none", rename = "blockIO")] + pub block_io: Option, + #[serde( + default, + skip_serializing_if = "Vec::is_empty", + rename = "hugepageLimits" + )] + pub hugepage_limits: Vec, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub network: Option, + #[serde(default, skip_serializing_if = "HashMap::is_empty")] + pub rdma: HashMap, +} + +#[derive(Serialize, Deserialize, Debug)] +pub struct LinuxDevice { + #[serde(default, skip_serializing_if = "String::is_empty")] + pub path: String, + #[serde(default, skip_serializing_if = "String::is_empty")] + pub r#type: String, + #[serde(default)] + pub major: i64, + #[serde(default)] + pub minor: i64, + #[serde(default, skip_serializing_if = "Option::is_none", rename = "fileMode")] + pub file_mode: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub uid: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub gid: Option, +} + +#[derive(Serialize, Deserialize, Debug)] +pub struct LinuxDeviceCgroup { + #[serde(default)] + pub allow: bool, + #[serde(default, skip_serializing_if = "String::is_empty")] + pub r#type: String, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub major: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub minor: Option, + #[serde(default, skip_serializing_if = "String::is_empty")] + pub access: String, +} + +#[derive(Serialize, Deserialize, Debug)] +pub struct Solaris { + #[serde(default, skip_serializing_if = "String::is_empty")] + pub milestone: String, + #[serde(default, skip_serializing_if = "String::is_empty")] + pub limitpriv: String, + #[serde( + default, + skip_serializing_if = "String::is_empty", + rename = "maxShmMemory" + )] + pub max_shm_memory: String, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub anet: Vec, + #[serde(default, skip_serializing_if = "Option::is_none", rename = "cappedCPU")] + pub capped_cpu: Option, + #[serde( + default, + skip_serializing_if = "Option::is_none", + rename = "cappedMemory" + )] + pub capped_memory: Option, +} + +#[derive(Serialize, Deserialize, Debug)] +pub struct SolarisCappedCPU { + #[serde(default, skip_serializing_if = "String::is_empty")] + pub ncpus: String, +} + +#[derive(Serialize, Deserialize, Debug)] +pub struct SolarisCappedMemory { + #[serde(default, skip_serializing_if = "String::is_empty")] + pub physical: String, + #[serde(default, skip_serializing_if = "String::is_empty")] + pub swap: String, +} + +#[derive(Serialize, Deserialize, Debug)] +pub struct SolarisAnet { + #[serde(default, skip_serializing_if = "String::is_empty", rename = "linkname")] + pub link_name: String, + #[serde( + default, + skip_serializing_if = "String::is_empty", + rename = "lowerLink" + )] + pub lower_link: String, + #[serde( + default, + skip_serializing_if = "String::is_empty", + rename = "allowdAddress" + )] + pub allowed_addr: String, + #[serde( + default, + skip_serializing_if = "String::is_empty", + rename = "configureAllowedAddress" + )] + pub config_allowed_addr: String, + #[serde(default, skip_serializing_if = "String::is_empty")] + pub defrouter: String, + #[serde( + default, + skip_serializing_if = "String::is_empty", + rename = "linkProtection" + )] + pub link_protection: String, + #[serde( + default, + skip_serializing_if = "String::is_empty", + rename = "macAddress" + )] + pub mac_address: String, +} + +#[derive(Serialize, Deserialize, Debug)] +pub struct Windows { + #[serde( + default, + skip_serializing_if = "Vec::is_empty", + rename = "layerFolders" + )] + pub layer_folders: Vec, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub resources: Option, + #[serde(default, rename = "credentialSpec")] + pub credential_spec: T, + #[serde(default)] + pub servicing: bool, + #[serde(default, rename = "ignoreFlushesDuringBoot")] + pub ignore_flushes_during_boot: bool, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub hyperv: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub network: Option, +} + +#[derive(Serialize, Deserialize, Debug)] +pub struct WindowsResources { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub memory: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub cpu: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub storage: Option, +} + +#[derive(Serialize, Deserialize, Debug)] +pub struct WindowsMemoryResources { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub limit: Option, +} + +#[derive(Serialize, Deserialize, Debug)] +pub struct WindowsCPUResources { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub count: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub shares: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub maximum: Option, +} + +#[derive(Serialize, Deserialize, Debug)] +pub struct WindowsStorageResources { + #[serde(default, skip_serializing_if = "Option::is_none")] + pub iops: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub bps: Option, + #[serde( + default, + skip_serializing_if = "Option::is_none", + rename = "sandboxSize" + )] + pub sandbox_size: Option, +} + +#[derive(Serialize, Deserialize, Debug)] +pub struct WindowsNetwork { + #[serde( + default, + skip_serializing_if = "Vec::is_empty", + rename = "endpointList" + )] + pub endpoint_list: Vec, + #[serde(default, rename = "allowUnqualifiedDNSQuery")] + pub allow_unqualified_dns_query: bool, + #[serde( + default, + skip_serializing_if = "Vec::is_empty", + rename = "DNSSearchList" + )] + pub dns_search_list: Vec, + #[serde( + default, + skip_serializing_if = "String::is_empty", + rename = "nwtworkSharedContainerName" + )] + pub network_shared_container_name: String, +} + +#[derive(Serialize, Deserialize, Debug)] +pub struct WindowsHyperV { + #[serde( + default, + skip_serializing_if = "String::is_empty", + rename = "utilityVMPath" + )] + pub utility_vm_path: String, +} + +#[derive(Serialize, Deserialize, Debug)] +pub struct VM { + pub hypervisor: VMHypervisor, + pub kernel: VMKernel, + pub image: VMImage, +} + +#[derive(Serialize, Deserialize, Debug)] +pub struct VMHypervisor { + #[serde(default)] + pub path: String, + #[serde(default, skip_serializing_if = "String::is_empty")] + pub parameters: String, +} + +#[derive(Serialize, Deserialize, Debug)] +pub struct VMKernel { + #[serde(default)] + pub path: String, + #[serde(default, skip_serializing_if = "String::is_empty")] + pub parameters: String, + #[serde(default, skip_serializing_if = "String::is_empty")] + pub initrd: String, +} + +#[derive(Serialize, Deserialize, Debug)] +pub struct VMImage { + #[serde(default)] + pub path: String, + #[serde(default)] + pub format: String, +} + +#[derive(Serialize, Deserialize, Debug)] +pub struct LinuxSeccomp { + #[serde(default, rename = "defaultAction")] + pub default_action: LinuxSeccompAction, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub architectures: Vec, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub syscalls: Vec, +} + +pub type Arch = String; + +#[allow(dead_code)] +pub const ARCHX86: &'static str = "SCMP_ARCH_X86"; +#[allow(dead_code)] +pub const ARCHX86_64: &'static str = "SCMP_ARCH_X86_64"; +#[allow(dead_code)] +pub const ARCHX32: &'static str = "SCMP_ARCH_X32"; +#[allow(dead_code)] +pub const ARCHARM: &'static str = "SCMP_ARCH_ARM"; +#[allow(dead_code)] +pub const ARCHAARCH64: &'static str = "SCMP_ARCH_AARCH64"; +#[allow(dead_code)] +pub const ARCHMIPS: &'static str = "SCMP_ARCH_MIPS"; +#[allow(dead_code)] +pub const ARCHMIPS64: &'static str = "SCMP_ARCH_MIPS64"; +#[allow(dead_code)] +pub const ARCHMIPS64N32: &'static str = "SCMP_ARCH_MIPS64N32"; +#[allow(dead_code)] +pub const ARCHMIPSEL: &'static str = "SCMP_ARCH_MIPSEL"; +#[allow(dead_code)] +pub const ARCHMIPSEL64: &'static str = "SCMP_ARCH_MIPSEL64"; +#[allow(dead_code)] +pub const ARCHMIPSEL64N32: &'static str = "SCMP_ARCH_MIPSEL64N32"; +#[allow(dead_code)] +pub const ARCHPPC: &'static str = "SCMP_ARCH_PPC"; +#[allow(dead_code)] +pub const ARCHPPC64: &'static str = "SCMP_ARCH_PPC64"; +#[allow(dead_code)] +pub const ARCHPPC64LE: &'static str = "SCMP_ARCH_PPC64LE"; +#[allow(dead_code)] +pub const ARCHS390: &'static str = "SCMP_ARCH_S390"; +#[allow(dead_code)] +pub const ARCHS390X: &'static str = "SCMP_ARCH_S390X"; +#[allow(dead_code)] +pub const ARCHPARISC: &'static str = "SCMP_ARCH_PARISC"; +#[allow(dead_code)] +pub const ARCHPARISC64: &'static str = "SCMP_ARCH_PARISC64"; + +pub type LinuxSeccompAction = String; + +#[allow(dead_code)] +pub const ACTKILL: &'static str = "SCMP_ACT_KILL"; +#[allow(dead_code)] +pub const ACTTRAP: &'static str = "SCMP_ACT_TRAP"; +#[allow(dead_code)] +pub const ACTERRNO: &'static str = "SCMP_ACT_ERRNO"; +#[allow(dead_code)] +pub const ACTTRACE: &'static str = "SCMP_ACT_TRACE"; +#[allow(dead_code)] +pub const ACTALLOW: &'static str = "SCMP_ACT_ALLOW"; + +pub type LinuxSeccompOperator = String; + +#[allow(dead_code)] +pub const OPNOTEQUAL: &'static str = "SCMP_CMP_NE"; +#[allow(dead_code)] +pub const OPLESSTHAN: &'static str = "SCMP_CMP_LT"; +#[allow(dead_code)] +pub const OPLESSEQUAL: &'static str = "SCMP_CMP_LE"; +#[allow(dead_code)] +pub const OPEQUALTO: &'static str = "SCMP_CMP_EQ"; +#[allow(dead_code)] +pub const OPGREATEREQUAL: &'static str = "SCMP_CMP_GE"; +#[allow(dead_code)] +pub const OPGREATERTHAN: &'static str = "SCMP_CMP_GT"; +#[allow(dead_code)] +pub const OPMASKEDEQUAL: &'static str = "SCMP_CMP_MASKED_EQ"; + +#[derive(Serialize, Deserialize, Debug)] +pub struct LinuxSeccompArg { + #[serde(default)] + pub index: u32, + #[serde(default)] + pub value: u64, + #[serde(default, rename = "valueTwo")] + pub value_two: u64, + #[serde(default)] + pub op: LinuxSeccompOperator, +} + +#[derive(Serialize, Deserialize, Debug)] +pub struct LinuxSyscall { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub names: Vec, + #[serde(default, skip_serializing_if = "String::is_empty")] + pub action: LinuxSeccompAction, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub args: Vec, +} + +#[derive(Serialize, Deserialize, Debug)] +pub struct LinuxIntelRdt { + #[serde( + default, + skip_serializing_if = "String::is_empty", + rename = "l3CacheSchema" + )] + pub l3_cache_schema: String, +} + +#[derive(Serialize, Deserialize, Debug)] +pub struct State { + #[serde( + default, + skip_serializing_if = "String::is_empty", + rename = "ociVersion" + )] + pub version: String, + #[serde(default, skip_serializing_if = "String::is_empty")] + pub id: String, + #[serde(default, skip_serializing_if = "String::is_empty")] + pub status: String, + #[serde(default)] + pub pid: i32, + #[serde(default, skip_serializing_if = "String::is_empty")] + pub bundle: String, + #[serde(default, skip_serializing_if = "HashMap::is_empty")] + pub annotations: HashMap, +} + +#[cfg(test)] +mod tests { + #[test] + fn it_works() { + assert_eq!(2 + 2, 4); + } +} diff --git a/src/agent/oci/src/serialize.rs b/src/agent/oci/src/serialize.rs new file mode 100644 index 0000000000..2ef52e1f2e --- /dev/null +++ b/src/agent/oci/src/serialize.rs @@ -0,0 +1,87 @@ +// Copyright (c) 2019 Ant Financial +// +// SPDX-License-Identifier: Apache-2.0 +// + +use serde; +use serde::{Deserialize, Serialize}; +use serde_json; + +use std::error::Error; +use std::fmt::{self, Formatter}; +use std::fs::File; +use std::io; + +#[derive(Debug)] +pub enum SerializeError { + Io(io::Error), + Json(serde_json::Error), +} + +impl fmt::Display for SerializeError { + fn fmt(&self, f: &mut Formatter) -> fmt::Result { + match *self { + SerializeError::Io(ref e) => e.fmt(f), + SerializeError::Json(ref e) => e.fmt(f), + } + } +} + +impl Error for SerializeError { + fn description(&self) -> &str { + match *self { + SerializeError::Io(ref e) => e.description(), + SerializeError::Json(ref e) => e.description(), + } + } + + fn cause(&self) -> Option<&dyn Error> { + match *self { + SerializeError::Io(ref e) => Some(e), + SerializeError::Json(ref e) => Some(e), + } + } +} + +impl From for SerializeError { + fn from(e: io::Error) -> SerializeError { + SerializeError::Io(e) + } +} + +impl From for SerializeError { + fn from(e: serde_json::Error) -> SerializeError { + SerializeError::Json(e) + } +} + +pub fn to_writer(o: &T, mut w: W) -> Result<(), SerializeError> +where + W: io::Write, + T: Serialize, +{ + Ok(serde_json::to_writer(&mut w, &o)?) +} + +pub fn serialize(o: &T, path: &str) -> Result<(), SerializeError> +where + T: Serialize, +{ + let mut f = File::create(path)?; + Ok(serde_json::to_writer(&mut f, &o)?) +} + +pub fn to_string(o: &T) -> Result +where + T: Serialize, +{ + Ok(serde_json::to_string(&o)?) +} + +pub fn deserialize(path: &str) -> Result +where + for<'a> T: Deserialize<'a>, +{ + let f = File::open(path)?; + Ok(serde_json::from_reader(&f)?) +} diff --git a/src/agent/protocols/Cargo.toml b/src/agent/protocols/Cargo.toml new file mode 100644 index 0000000000..fc68c94769 --- /dev/null +++ b/src/agent/protocols/Cargo.toml @@ -0,0 +1,10 @@ +[package] +name = "protocols" +version = "0.1.0" +authors = ["Hui Zhu "] +edition = "2018" + +[dependencies] +grpcio = { git="https://github.com/alipay/grpc-rs", branch="rust_agent" } +protobuf = "2.6.1" +futures = "0.1.27" diff --git a/src/agent/protocols/hack/update-generated-proto.sh b/src/agent/protocols/hack/update-generated-proto.sh new file mode 100755 index 0000000000..5e5465fc96 --- /dev/null +++ b/src/agent/protocols/hack/update-generated-proto.sh @@ -0,0 +1,68 @@ +#!/bin/bash + +die() { + echo $1 + exit +} + +get_source_version() { + if [ ! -d $GOPATH/src/$1 ]; then + go get -d -v $1 + fi + [ $? -eq 0 ] || die "Failed to get $1" + if [ "$2" != "" ] ; then + pushd "${GOPATH}/src/$1" + if [ $(git rev-parse HEAD) != $2 ] ; then + git checkout $2 + [ $? -eq 0 ] || die "Failed to get $1 $2" + fi + popd + fi +} + +get_rs() { + local cmd="protoc --rust_out=./src/ --grpc_out=./src/,plugins=grpc:./src/ --plugin=protoc-gen-grpc=`which grpc_rust_plugin` -I ./protos/ ./protos/$1" + echo $cmd + $cmd + [ $? -eq 0 ] || die "Failed to get rust from $1" +} + +if [ "$(basename $(pwd))" != "protocols" ] || [ ! -d "./hack/" ]; then + die "Please go to directory of protocols before execute this shell" +fi +which protoc +[ $? -eq 0 ] || die "Please install protoc from github.com/protocolbuffers/protobuf" +which protoc-gen-rust +[ $? -eq 0 ] || die "Please install protobuf-codegen from github.com/pingcap/grpc-rs" +which grpc_rust_plugin +[ $? -eq 0 ] || die "Please install grpc_rust_plugin from github.com/pingcap/grpc-rs" + +if [ $UPDATE_PROTOS ]; then + if [ ! $GOPATH ]; then + die 'Need $GOPATH to get the proto files' + fi + + get_source_version "github.com/kata-containers/agent" "" + cp $GOPATH/src/github.com/kata-containers/agent/protocols/grpc/agent.proto ./protos/ + cp $GOPATH/src/github.com/kata-containers/agent/protocols/grpc/oci.proto ./protos/ + cp $GOPATH/src/github.com/kata-containers/agent/protocols/grpc/health.proto ./protos/ + mkdir -p ./protos/github.com/kata-containers/agent/pkg/types/ + cp $GOPATH/src/github.com/kata-containers/agent/pkg/types/types.proto ./protos/github.com/kata-containers/agent/pkg/types/ + + # The version is get from https://github.com/kata-containers/agent/blob/master/Gopkg.toml + get_source_version "github.com/gogo/protobuf" "4cbf7e384e768b4e01799441fdf2a706a5635ae7" + mkdir -p ./protos/github.com/gogo/protobuf/gogoproto/ + cp $GOPATH/src/github.com/gogo/protobuf/gogoproto/gogo.proto ./protos/github.com/gogo/protobuf/gogoproto/ + mkdir -p ./protos/google/protobuf/ + cp $GOPATH/src/github.com/gogo/protobuf/protobuf/google/protobuf/empty.proto ./protos/google/protobuf/ +fi + +get_rs agent.proto +get_rs health.proto +get_rs github.com/kata-containers/agent/pkg/types/types.proto +get_rs google/protobuf/empty.proto + +get_rs oci.proto +# Need change Box to ::std::boxed::Box because there is another struct Box +sed 's/fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> {/fn into_any(self: ::std::boxed::Box) -> ::std::boxed::Box<::std::any::Any> {/g' src/oci.rs > src/new_oci.rs +mv src/new_oci.rs src/oci.rs diff --git a/src/agent/protocols/protos/agent.proto b/src/agent/protocols/protos/agent.proto new file mode 100644 index 0000000000..565f7c0fdb --- /dev/null +++ b/src/agent/protocols/protos/agent.proto @@ -0,0 +1,487 @@ +// +// Copyright 2017 HyperHQ Inc. +// Copyright 2019 Ant Financial +// +// SPDX-License-Identifier: Apache-2.0 +// + +syntax = "proto3"; + +package grpc; + +import "oci.proto"; +import "github.com/kata-containers/agent/pkg/types/types.proto"; +import "google/protobuf/empty.proto"; + +// unstable +service AgentService { + // execution + rpc CreateContainer(CreateContainerRequest) returns (google.protobuf.Empty); + rpc StartContainer(StartContainerRequest) returns (google.protobuf.Empty); + + // RemoveContainer will tear down an existing container by forcibly terminating + // all processes running inside that container and releasing all internal + // resources associated with it. + // RemoveContainer will wait for all processes termination before returning. + // If any process can not be killed or if it can not be killed after + // the RemoveContainerRequest timeout, RemoveContainer will return an error. + rpc RemoveContainer(RemoveContainerRequest) returns (google.protobuf.Empty); + rpc ExecProcess(ExecProcessRequest) returns (google.protobuf.Empty); + rpc SignalProcess(SignalProcessRequest) returns (google.protobuf.Empty); + rpc WaitProcess(WaitProcessRequest) returns (WaitProcessResponse); // wait & reap like waitpid(2) + rpc ListProcesses(ListProcessesRequest) returns (ListProcessesResponse); + rpc UpdateContainer(UpdateContainerRequest) returns (google.protobuf.Empty); + rpc StatsContainer(StatsContainerRequest) returns (StatsContainerResponse); + rpc PauseContainer(PauseContainerRequest) returns (google.protobuf.Empty); + rpc ResumeContainer(ResumeContainerRequest) returns (google.protobuf.Empty); + + // stdio + rpc WriteStdin(WriteStreamRequest) returns (WriteStreamResponse); + rpc ReadStdout(ReadStreamRequest) returns (ReadStreamResponse); + rpc ReadStderr(ReadStreamRequest) returns (ReadStreamResponse); + rpc CloseStdin(CloseStdinRequest) returns (google.protobuf.Empty); + rpc TtyWinResize(TtyWinResizeRequest) returns (google.protobuf.Empty); + + // networking + rpc UpdateInterface(UpdateInterfaceRequest) returns (types.Interface); + rpc UpdateRoutes(UpdateRoutesRequest) returns (Routes); + rpc ListInterfaces(ListInterfacesRequest) returns(Interfaces); + rpc ListRoutes(ListRoutesRequest) returns (Routes); + + // tracing + rpc StartTracing(StartTracingRequest) returns (google.protobuf.Empty); + rpc StopTracing(StopTracingRequest) returns (google.protobuf.Empty); + + // misc (TODO: some rpcs can be replaced by hyperstart-exec) + rpc CreateSandbox(CreateSandboxRequest) returns (google.protobuf.Empty); + rpc DestroySandbox(DestroySandboxRequest) returns (google.protobuf.Empty); + rpc OnlineCPUMem(OnlineCPUMemRequest) returns (google.protobuf.Empty); + rpc ReseedRandomDev(ReseedRandomDevRequest) returns (google.protobuf.Empty); + rpc GetGuestDetails(GuestDetailsRequest) returns (GuestDetailsResponse); + rpc MemHotplugByProbe(MemHotplugByProbeRequest) returns (google.protobuf.Empty); + rpc SetGuestDateTime(SetGuestDateTimeRequest) returns (google.protobuf.Empty); + rpc CopyFile(CopyFileRequest) returns (google.protobuf.Empty); +} + +message CreateContainerRequest { + string container_id = 1; + string exec_id = 2; + StringUser string_user = 3; + repeated Device devices = 4; + repeated Storage storages = 5; + Spec OCI = 6; + + // This field is used to indicate if the container needs to join + // sandbox shared pid ns or create a new namespace. This field is + // meant to override the NEWPID config settings in the OCI spec. + // The agent would receive an OCI spec with PID namespace cleared + // out altogether and not just the pid ns path. + bool sandbox_pidns = 7; +} + +message StartContainerRequest { + string container_id = 1; +} + +message RemoveContainerRequest { + string container_id = 1; + + // RemoveContainer will return an error if + // it could not kill some container processes + // after timeout seconds. + // Setting timeout to 0 means RemoveContainer will + // wait for ever. + uint32 timeout = 2; +} + +message ExecProcessRequest { + string container_id = 1; + string exec_id = 2; + StringUser string_user = 3; + Process process = 4; +} + +message SignalProcessRequest { + string container_id = 1; + + // Special case for SignalProcess(): exec_id can be empty(""), + // which means to send the signal to all the processes including their descendants. + // Other APIs with exec_id should treat empty exec_id as an invalid request. + string exec_id = 2; + uint32 signal = 3; +} + +message WaitProcessRequest { + string container_id = 1; + string exec_id = 2; +} + +message WaitProcessResponse { + int32 status = 1; +} + +// ListProcessesRequest contains the options used to list running processes inside the container +message ListProcessesRequest { + string container_id = 1; + string format = 2; + repeated string args = 3; +} + +// ListProcessesResponse represents the list of running processes inside the container +message ListProcessesResponse { + bytes process_list = 1; +} + +message UpdateContainerRequest { + string container_id = 1; + LinuxResources resources = 2; +} + +message StatsContainerRequest { + string container_id = 1; +} + +message PauseContainerRequest { + string container_id = 1; +} + +message ResumeContainerRequest { + string container_id = 1; +} + +message CpuUsage { + uint64 total_usage = 1; + repeated uint64 percpu_usage = 2; + uint64 usage_in_kernelmode = 3; + uint64 usage_in_usermode = 4; +} + +message ThrottlingData { + uint64 periods = 1; + uint64 throttled_periods = 2; + uint64 throttled_time = 3; +} + +message CpuStats { + CpuUsage cpu_usage = 1; + ThrottlingData throttling_data = 2; +} + +message PidsStats { + uint64 current = 1; + uint64 limit = 2; +} + +message MemoryData { + uint64 usage = 1; + uint64 max_usage = 2; + uint64 failcnt = 3; + uint64 limit = 4; +} + +message MemoryStats { + uint64 cache = 1; + MemoryData usage = 2; + MemoryData swap_usage = 3; + MemoryData kernel_usage = 4; + bool use_hierarchy = 5; + map stats = 6; +} + + +message BlkioStatsEntry { + uint64 major = 1; + uint64 minor = 2; + string op = 3; + uint64 value = 4; +} + +message BlkioStats { + repeated BlkioStatsEntry io_service_bytes_recursive = 1; // number of bytes transferred to and from the block device + repeated BlkioStatsEntry io_serviced_recursive = 2; + repeated BlkioStatsEntry io_queued_recursive = 3; + repeated BlkioStatsEntry io_service_time_recursive = 4; + repeated BlkioStatsEntry io_wait_time_recursive = 5; + repeated BlkioStatsEntry io_merged_recursive = 6; + repeated BlkioStatsEntry io_time_recursive = 7; + repeated BlkioStatsEntry sectors_recursive = 8; +} + +message HugetlbStats { + uint64 usage = 1; + uint64 max_usage = 2; + uint64 failcnt = 3; +} + +message CgroupStats { + CpuStats cpu_stats = 1; + MemoryStats memory_stats = 2; + PidsStats pids_stats = 3; + BlkioStats blkio_stats = 4; + map hugetlb_stats = 5; // the map is in the format "size of hugepage: stats of the hugepage" + +} + +message NetworkStats { + string name = 1; + uint64 rx_bytes = 2; + uint64 rx_packets = 3; + uint64 rx_errors = 4; + uint64 rx_dropped = 5; + uint64 tx_bytes = 6; + uint64 tx_packets = 7; + uint64 tx_errors = 8; + uint64 tx_dropped = 9; +} + +message StatsContainerResponse { + CgroupStats cgroup_stats = 1; + repeated NetworkStats network_stats = 2; +} + +message WriteStreamRequest { + string container_id = 1; + string exec_id = 2; + bytes data = 3; +} + +message WriteStreamResponse { + uint32 len = 1; +} + +message ReadStreamRequest { + string container_id = 1; + string exec_id = 2; + uint32 len = 3; +} + +message ReadStreamResponse { + bytes data = 1; +} + +message CloseStdinRequest { + string container_id = 1; + string exec_id = 2; +} + +message TtyWinResizeRequest { + string container_id = 1; + string exec_id = 2; + uint32 row = 3; + uint32 column = 4; +} + +message CreateSandboxRequest { + string hostname = 1; + repeated string dns = 2; + repeated Storage storages = 3; + + // This field means that a pause process needs to be created by the + // agent. This pid namespace of the pause process will be treated as + // a shared pid namespace. All containers created will join this shared + // pid namespace. + bool sandbox_pidns = 4; + // SandboxId identifies which sandbox is using the agent. We allow only + // one sandbox per agent and implicitly require that CreateSandbox is + // called before other sandbox/network calls. + string sandbox_id = 5; + // This field, if non-empty, designates an absolute path to a directory + // that the agent will search for OCI hooks to run within the guest. + string guest_hook_path = 6; +} + +message DestroySandboxRequest { +} + +message Interfaces { + repeated types.Interface Interfaces = 1; +} + +message Routes { + repeated types.Route Routes = 1; +} + +message UpdateInterfaceRequest { + types.Interface interface = 1; +} + +message UpdateRoutesRequest { + Routes routes = 1; +} + +message ListInterfacesRequest { +} + +message ListRoutesRequest { +} + +message OnlineCPUMemRequest { + // Wait specifies if the caller waits for the agent to online all resources. + // If true the agent returns once all resources have been connected, otherwise all + // resources are connected asynchronously and the agent returns immediately. + bool wait = 1; + + // NbCpus specifies the number of CPUs that were added and the agent has to online. + uint32 nb_cpus = 2; + + // CpuOnly specifies whether only online CPU or not. + bool cpu_only = 3; +} + +message ReseedRandomDevRequest { + // Data specifies the random data used to reseed the guest crng. + bytes data = 2; +} + +// AgentDetails provides information to the client about the running agent. +message AgentDetails { + // Semantic version of agent (see https://semver.org). + string version = 1; + + // Set if the agent is running as PID 1. + bool init_daemon = 2; + + // List of available device handlers. + repeated string device_handlers = 3; + + // List of available storage handlers. + repeated string storage_handlers = 4; + + // Set only if the agent is built with seccomp support and the guest + // environment supports seccomp. + bool supports_seccomp = 5; +} + +message GuestDetailsRequest { + // MemBlockSize asks server to return the system memory block size that can be used + // for memory hotplug alignment. Typically the server returns what's in + // /sys/devices/system/memory/block_size_bytes. + bool mem_block_size = 1; + + // MemoryHotplugProbe asks server to return whether guest kernel supports memory hotplug + // via probeinterface. Typically the server will check if the path + // /sys/devices/system/memory/probe exists. + bool mem_hotplug_probe = 2; +} + +message GuestDetailsResponse { + // MemBlockSizeBytes returns the system memory block size in bytes. + uint64 mem_block_size_bytes = 1; + + AgentDetails agent_details = 2; + + bool support_mem_hotplug_probe = 3; +} + +message MemHotplugByProbeRequest { + // server needs to send the value of memHotplugProbeAddr into file /sys/devices/system/memory/probe, + // in order to notify the guest kernel about hot-add memory event + repeated uint64 memHotplugProbeAddr = 1; +} + +message SetGuestDateTimeRequest { + // Sec the second since the Epoch. + int64 Sec = 1; + // Usec the microseconds portion of time since the Epoch. + int64 Usec = 2; +} + +// Storage represents both the rootfs of the container, and any volume that +// could have been defined through the Mount list of the OCI specification. +message Storage { + // Driver is used to define the way the storage is passed through the + // virtual machine. It can be "9p", "blk", or something else, but for + // all cases, this will define if some extra steps are required before + // this storage gets mounted into the container. + string driver = 1; + // DriverOptions allows the caller to define a list of options such + // as block sizes, numbers of luns, ... which are very specific to + // every device and cannot be generalized through extra fields. + repeated string driver_options = 2; + // Source can be anything representing the source of the storage. This + // will be handled by the proper handler based on the Driver used. + // For instance, it can be a very simple path if the caller knows the + // name of device inside the VM, or it can be some sort of identifier + // to let the agent find the device inside the VM. + string source = 3; + // Fstype represents the filesystem that needs to be used to mount the + // storage inside the VM. For instance, it could be "xfs" for block + // device, "9p" for shared filesystem, or "tmpfs" for shared /dev/shm. + string fstype = 4; + // Options describes the additional options that might be needed to + // mount properly the storage filesytem. + repeated string options = 5; + // MountPoint refers to the path where the storage should be mounted + // inside the VM. + string mount_point = 6; +} + +// Device represents only the devices that could have been defined through the +// Linux Device list of the OCI specification. +message Device { + // Id can be used to identify the device inside the VM. Some devices + // might not need it to be identified on the VM, and will rely on the + // provided VmPath instead. + string id = 1; + // Type defines the type of device described. This can be "blk", + // "scsi", "vfio", ... + // Particularly, this should be used to trigger the use of the + // appropriate device handler. + string type = 2; + // VmPath can be used by the caller to provide directly the path of + // the device as it will appear inside the VM. For some devices, the + // device id or the list of options passed might not be enough to find + // the device. In those cases, the caller should predict and provide + // this vm_path. + string vm_path = 3; + // ContainerPath defines the path where the device should be found inside + // the container. This path should match the path of the device from + // the device list listed inside the OCI spec. This is used in order + // to identify the right device in the spec and update it with the + // right options such as major/minor numbers as they appear inside + // the VM for instance. Note that an empty ctr_path should be used + // to make sure the device handler inside the agent is called, but + // no spec update needs to be performed. This has to happen for the + // case of rootfs, when a device has to be waited for after it has + // been hotplugged. An equivalent Storage entry should be defined if + // any mount needs to be performed afterwards. + string container_path = 4; + // Options allows the caller to define a list of options such as block + // sizes, numbers of luns, ... which are very specific to every device + // and cannot be generalized through extra fields. + repeated string options = 5; +} + +message StringUser { + string uid = 1; + string gid = 2; + repeated string additionalGids = 3; +} + +message CopyFileRequest { + // Path is the destination file in the guest. It must be absolute, + // canonical and below /run. + string path = 1; + // FileSize is the expected file size, for security reasons write operations + // are made in a temporary file, once it has the expected size, it's moved + // to the destination path. + int64 file_size = 2; + // FileMode is the file mode. + uint32 file_mode = 3; + // DirMode is the mode for the parent directories of destination path. + uint32 dir_mode = 4; + // Uid is the numeric user id. + int32 uid = 5; + // Gid is the numeric group id. + int32 gid = 6; + // Offset for the next write operation. + int64 offset = 7; + // Data to write in the destination file. + bytes data = 8; +} + +message StartTracingRequest { +} + +message StopTracingRequest { +} diff --git a/src/agent/protocols/protos/github.com/gogo/protobuf/gogoproto/gogo.proto b/src/agent/protocols/protos/github.com/gogo/protobuf/gogoproto/gogo.proto new file mode 100644 index 0000000000..b80c85653f --- /dev/null +++ b/src/agent/protocols/protos/github.com/gogo/protobuf/gogoproto/gogo.proto @@ -0,0 +1,144 @@ +// Protocol Buffers for Go with Gadgets +// +// Copyright (c) 2013, The GoGo Authors. All rights reserved. +// http://github.com/gogo/protobuf +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +syntax = "proto2"; +package gogoproto; + +import "google/protobuf/descriptor.proto"; + +option java_package = "com.google.protobuf"; +option java_outer_classname = "GoGoProtos"; +option go_package = "github.com/gogo/protobuf/gogoproto"; + +extend google.protobuf.EnumOptions { + optional bool goproto_enum_prefix = 62001; + optional bool goproto_enum_stringer = 62021; + optional bool enum_stringer = 62022; + optional string enum_customname = 62023; + optional bool enumdecl = 62024; +} + +extend google.protobuf.EnumValueOptions { + optional string enumvalue_customname = 66001; +} + +extend google.protobuf.FileOptions { + optional bool goproto_getters_all = 63001; + optional bool goproto_enum_prefix_all = 63002; + optional bool goproto_stringer_all = 63003; + optional bool verbose_equal_all = 63004; + optional bool face_all = 63005; + optional bool gostring_all = 63006; + optional bool populate_all = 63007; + optional bool stringer_all = 63008; + optional bool onlyone_all = 63009; + + optional bool equal_all = 63013; + optional bool description_all = 63014; + optional bool testgen_all = 63015; + optional bool benchgen_all = 63016; + optional bool marshaler_all = 63017; + optional bool unmarshaler_all = 63018; + optional bool stable_marshaler_all = 63019; + + optional bool sizer_all = 63020; + + optional bool goproto_enum_stringer_all = 63021; + optional bool enum_stringer_all = 63022; + + optional bool unsafe_marshaler_all = 63023; + optional bool unsafe_unmarshaler_all = 63024; + + optional bool goproto_extensions_map_all = 63025; + optional bool goproto_unrecognized_all = 63026; + optional bool gogoproto_import = 63027; + optional bool protosizer_all = 63028; + optional bool compare_all = 63029; + optional bool typedecl_all = 63030; + optional bool enumdecl_all = 63031; + + optional bool goproto_registration = 63032; + optional bool messagename_all = 63033; + + optional bool goproto_sizecache_all = 63034; + optional bool goproto_unkeyed_all = 63035; +} + +extend google.protobuf.MessageOptions { + optional bool goproto_getters = 64001; + optional bool goproto_stringer = 64003; + optional bool verbose_equal = 64004; + optional bool face = 64005; + optional bool gostring = 64006; + optional bool populate = 64007; + optional bool stringer = 67008; + optional bool onlyone = 64009; + + optional bool equal = 64013; + optional bool description = 64014; + optional bool testgen = 64015; + optional bool benchgen = 64016; + optional bool marshaler = 64017; + optional bool unmarshaler = 64018; + optional bool stable_marshaler = 64019; + + optional bool sizer = 64020; + + optional bool unsafe_marshaler = 64023; + optional bool unsafe_unmarshaler = 64024; + + optional bool goproto_extensions_map = 64025; + optional bool goproto_unrecognized = 64026; + + optional bool protosizer = 64028; + optional bool compare = 64029; + + optional bool typedecl = 64030; + + optional bool messagename = 64033; + + optional bool goproto_sizecache = 64034; + optional bool goproto_unkeyed = 64035; +} + +extend google.protobuf.FieldOptions { + optional bool nullable = 65001; + optional bool embed = 65002; + optional string customtype = 65003; + optional string customname = 65004; + optional string jsontag = 65005; + optional string moretags = 65006; + optional string casttype = 65007; + optional string castkey = 65008; + optional string castvalue = 65009; + + optional bool stdtime = 65010; + optional bool stdduration = 65011; + optional bool wktpointer = 65012; + +} diff --git a/src/agent/protocols/protos/github.com/kata-containers/agent/pkg/types/types.proto b/src/agent/protocols/protos/github.com/kata-containers/agent/pkg/types/types.proto new file mode 100644 index 0000000000..470bbc0ae8 --- /dev/null +++ b/src/agent/protocols/protos/github.com/kata-containers/agent/pkg/types/types.proto @@ -0,0 +1,49 @@ +// +// Copyright 2018 Intel Corporation. +// Copyright (c) 2019 Ant Financial +// +// SPDX-License-Identifier: Apache-2.0 +// + +syntax = "proto3"; + +package types; + +enum IPFamily { + v4 = 0; + v6 = 1; +} + +message IPAddress { + IPFamily family = 1; + string address = 2; + string mask = 3; +} + +message Interface { + string device = 1; + string name = 2; + repeated IPAddress IPAddresses = 3; + uint64 mtu = 4; + string hwAddr = 5; + + // pciAddr is the PCI address in the format "bridgeAddr/deviceAddr". + // Here, bridgeAddr is the address at which the bridge is attached on the root bus, + // while deviceAddr is the address at which the network device is attached on the bridge. + string pciAddr = 6; + + // Type defines the type of interface described by this structure. + // The expected values are the one that are defined by the netlink + // library, regarding each type of link. Here is a non exhaustive + // list: "veth", "macvtap", "vlan", "macvlan", "tap", ... + string type = 7; + uint32 raw_flags = 8; +} + +message Route { + string dest = 1; + string gateway = 2; + string device = 3; + string source = 4; + uint32 scope = 5; +} diff --git a/src/agent/protocols/protos/google/protobuf/empty.proto b/src/agent/protocols/protos/google/protobuf/empty.proto new file mode 100644 index 0000000000..6057c8522d --- /dev/null +++ b/src/agent/protocols/protos/google/protobuf/empty.proto @@ -0,0 +1,52 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +syntax = "proto3"; + +package google.protobuf; + +option csharp_namespace = "Google.Protobuf.WellKnownTypes"; +option go_package = "types"; +option java_package = "com.google.protobuf"; +option java_outer_classname = "EmptyProto"; +option java_multiple_files = true; +option objc_class_prefix = "GPB"; +option cc_enable_arenas = true; + +// A generic empty message that you can re-use to avoid defining duplicated +// empty messages in your APIs. A typical example is to use it as the request +// or the response type of an API method. For instance: +// +// service Foo { +// rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); +// } +// +// The JSON representation for `Empty` is empty JSON object `{}`. +message Empty {} diff --git a/src/agent/protocols/protos/health.proto b/src/agent/protocols/protos/health.proto new file mode 100644 index 0000000000..8b31dcf890 --- /dev/null +++ b/src/agent/protocols/protos/health.proto @@ -0,0 +1,40 @@ +// +// Copyright 2017 HyperHQ Inc. +// Copyright (c) 2019 Ant Financial +// +// SPDX-License-Identifier: Apache-2.0 +// + +syntax = "proto3"; + +package grpc; + +import "github.com/gogo/protobuf/gogoproto/gogo.proto"; + +option (gogoproto.equal_all) = true; +option (gogoproto.populate_all) = true; +option (gogoproto.testgen_all) = true; +option (gogoproto.benchgen_all) = true; + +message CheckRequest { + string service = 1; +} + +message HealthCheckResponse { + enum ServingStatus { + UNKNOWN = 0; + SERVING = 1; + NOT_SERVING = 2; + } + ServingStatus status = 1; +} + +message VersionCheckResponse { + string grpc_version = 1; + string agent_version = 2; +} + +service Health { + rpc Check(CheckRequest) returns (HealthCheckResponse); + rpc Version(CheckRequest) returns (VersionCheckResponse); +} diff --git a/src/agent/protocols/protos/oci.proto b/src/agent/protocols/protos/oci.proto new file mode 100644 index 0000000000..b6e05e0aa4 --- /dev/null +++ b/src/agent/protocols/protos/oci.proto @@ -0,0 +1,463 @@ +// +// Copyright (c) 2017 Intel Corporation +// Copyright (c) 2019 Ant Financial +// +// SPDX-License-Identifier: Apache-2.0 +// + +syntax = "proto3"; + +package grpc; + +import "github.com/gogo/protobuf/gogoproto/gogo.proto"; +import "google/protobuf/wrappers.proto"; + +option (gogoproto.equal_all) = true; +option (gogoproto.populate_all) = true; +option (gogoproto.testgen_all) = true; +option (gogoproto.benchgen_all) = true; + +message Spec { + // Version of the Open Container Initiative Runtime Specification with which the bundle complies. + string Version = 1; + + // Process configures the container process. + Process Process = 2; + + // Root configures the container's root filesystem. + Root Root = 3; + + // Hostname configures the container's hostname. + string Hostname = 4; + + // Mounts configures additional mounts (on top of Root). + repeated Mount Mounts = 5 [(gogoproto.nullable) = false]; + + // Hooks configures callbacks for container lifecycle events. + Hooks Hooks = 6; + + // Annotations contains arbitrary metadata for the container. + map Annotations = 7; + + // Linux is platform-specific configuration for Linux based containers. + Linux Linux = 8; + + // Solaris is platform-specific configuration for Solaris based containers. + Solaris Solaris = 9; + // Windows is platform-specific configuration for Windows based containers. + Windows Windows = 10; +} + +message Process { + // Terminal creates an interactive terminal for the container. + bool Terminal = 1; + + // ConsoleSize specifies the size of the console. + Box ConsoleSize = 2; + + // User specifies user information for the process. + User User = 3 [(gogoproto.nullable) = false]; + + // Args specifies the binary and arguments for the application to execute. + repeated string Args = 4; + + // Env populates the process environment for the process. + repeated string Env = 5; + + // Cwd is the current working directory for the process and must be + // relative to the container's root. + string Cwd = 6; + + // Capabilities are Linux capabilities that are kept for the process. + LinuxCapabilities Capabilities = 7; + + // Rlimits specifies rlimit options to apply to the process. + repeated POSIXRlimit Rlimits = 8 [(gogoproto.nullable) = false]; + + // NoNewPrivileges controls whether additional privileges could be gained by processes in the container. + bool NoNewPrivileges = 9; + + // ApparmorProfile specifies the apparmor profile for the container. + string ApparmorProfile = 10; + + // Specify an oom_score_adj for the container. + int64 OOMScoreAdj = 11; + + // SelinuxLabel specifies the selinux context that the container process is run as. + string SelinuxLabel = 12; +} + +message Box { + // Height is the vertical dimension of a box. + uint32 Height = 1; + + // Width is the horizontal dimension of a box. + uint32 Width = 2; +} + +message User { + // UID is the user id. + uint32 UID = 1; + + // GID is the group id. + uint32 GID = 2; + + // AdditionalGids are additional group ids set for the container's process. + repeated uint32 AdditionalGids = 3; + + // Username is the user name. + string Username = 4; +} + +message LinuxCapabilities { + // Bounding is the set of capabilities checked by the kernel. + repeated string Bounding = 1; + + // Effective is the set of capabilities checked by the kernel. + repeated string Effective = 2; + + // Inheritable is the capabilities preserved across execve. + repeated string Inheritable = 3; + + // Permitted is the limiting superset for effective capabilities. + repeated string Permitted = 4; + + // Ambient is the ambient set of capabilities that are kept. + repeated string Ambient = 5; +} + +message POSIXRlimit { + // Type of the rlimit to set + string Type = 1; + + // Hard is the hard limit for the specified type + uint64 Hard = 2; + + // Soft is the soft limit for the specified type + uint64 Soft = 3; +} + +message Mount { + // destination is the path inside the container expect when it starts with "tmp:/" + string destination = 1; + + // source is the path inside the container expect when it starts with "vm:/dev/" or "tmp:/" + // the path which starts with "vm:/dev/" refers the guest vm's "/dev", + // especially, "vm:/dev/hostfs/" refers to the shared filesystem. + // "tmp:/" is a temporary directory which is used for temporary mounts. + string source = 2; + string type = 3; + repeated string options = 4; +} + +message Root { + // Path is the absolute path to the container's root filesystem. + string Path = 1; + + // Readonly makes the root filesystem for the container readonly before the process is executed. + bool Readonly = 2; +} + +message Hooks { + // Prestart is a list of hooks to be run before the container process is executed. + repeated Hook Prestart = 1 [(gogoproto.nullable) = false]; + + // Poststart is a list of hooks to be run after the container process is started. + repeated Hook Poststart = 2 [(gogoproto.nullable) = false]; + + // Poststop is a list of hooks to be run after the container process exits. + repeated Hook Poststop = 3 [(gogoproto.nullable) = false]; +} + +message Hook { + string Path = 1; + repeated string Args = 2; + repeated string Env = 3; + int64 Timeout = 4; +} + +message Linux { + // UIDMapping specifies user mappings for supporting user namespaces. + repeated LinuxIDMapping UIDMappings = 1 [(gogoproto.nullable) = false]; + + // GIDMapping specifies group mappings for supporting user namespaces. + repeated LinuxIDMapping GIDMappings = 2 [(gogoproto.nullable) = false]; + + // Sysctl are a set of key value pairs that are set for the container on start + map Sysctl = 3; + + // Resources contain cgroup information for handling resource constraints + // for the container + LinuxResources Resources = 4; + + // CgroupsPath specifies the path to cgroups that are created and/or joined by the container. + // The path is expected to be relative to the cgroups mountpoint. + // If resources are specified, the cgroups at CgroupsPath will be updated based on resources. + string CgroupsPath = 5; + + // Namespaces contains the namespaces that are created and/or joined by the container + repeated LinuxNamespace Namespaces = 6 [(gogoproto.nullable) = false]; + + // Devices are a list of device nodes that are created for the container + repeated LinuxDevice Devices = 7 [(gogoproto.nullable) = false]; + + // Seccomp specifies the seccomp security settings for the container. + LinuxSeccomp Seccomp = 8; + + // RootfsPropagation is the rootfs mount propagation mode for the container. + string RootfsPropagation = 9; + + // MaskedPaths masks over the provided paths inside the container. + repeated string MaskedPaths = 10; + + // ReadonlyPaths sets the provided paths as RO inside the container. + repeated string ReadonlyPaths = 11; + + // MountLabel specifies the selinux context for the mounts in the container. + string MountLabel = 12; + + // IntelRdt contains Intel Resource Director Technology (RDT) information + // for handling resource constraints (e.g., L3 cache) for the container + LinuxIntelRdt IntelRdt = 13; +} + +message Windows { + // Dummy string, never used. + string dummy = 1; +} + +message Solaris { + // Dummy string, never used. + string dummy = 1; +} + +message LinuxIDMapping { + // HostID is the starting UID/GID on the host to be mapped to 'ContainerID' + uint32 HostID = 1; + + // ContainerID is the starting UID/GID in the container + uint32 ContainerID = 2; + + // Size is the number of IDs to be mapped + uint32 Size = 3; +} + +message LinuxNamespace { + // Type is the type of namespace + string Type = 1; + + // Path is a path to an existing namespace persisted on disk that can be joined + // and is of the same type + string Path = 2; +} + +message LinuxDevice { + // Path to the device. + string Path = 1; + + // Device type, block, char, etc. + string Type = 2; + + // Major is the device's major number. + int64 Major = 3; + + // Minor is the device's minor number. + int64 Minor = 4; + + // FileMode permission bits for the device. + uint32 FileMode = 5; + + // UID of the device. + uint32 UID = 6; + + // Gid of the device. + uint32 GID = 7; +} + +message LinuxResources { + // Devices configures the device whitelist. + repeated LinuxDeviceCgroup Devices = 1 [(gogoproto.nullable) = false]; + + // Memory restriction configuration + LinuxMemory Memory = 2; + + // CPU resource restriction configuration + LinuxCPU CPU = 3; + + // Task resource restriction configuration. + LinuxPids Pids = 4; + + // BlockIO restriction configuration + LinuxBlockIO BlockIO = 5; + + // Hugetlb limit (in bytes) + repeated LinuxHugepageLimit HugepageLimits = 6 [(gogoproto.nullable) = false]; + + // Network restriction configuration + LinuxNetwork Network = 7; +} + +message LinuxMemory { + // Memory limit (in bytes). + int64 Limit = 1; + + // Memory reservation or soft_limit (in bytes). + int64 Reservation = 2; + + // Total memory limit (memory + swap). + int64 Swap = 3; + + // Kernel memory limit (in bytes). + int64 Kernel = 4; + + // Kernel memory limit for tcp (in bytes) + int64 KernelTCP = 5; + + // How aggressive the kernel will swap memory pages. + uint64 Swappiness = 6; + + // DisableOOMKiller disables the OOM killer for out of memory conditions + bool DisableOOMKiller = 7; +} + +message LinuxCPU { + // CPU shares (relative weight (ratio) vs. other cgroups with cpu shares). + uint64 Shares = 1; + + // CPU hardcap limit (in usecs). Allowed cpu time in a given period. + int64 Quota = 2; + + // CPU period to be used for hardcapping (in usecs). + uint64 Period = 3; + + // How much time realtime scheduling may use (in usecs). + int64 RealtimeRuntime = 4; + + // CPU period to be used for realtime scheduling (in usecs). + uint64 RealtimePeriod = 5; + + // CPUs to use within the cpuset. Default is to use any CPU available. + string Cpus = 6; + + // List of memory nodes in the cpuset. Default is to use any available memory node. + string Mems = 7; +} + +message LinuxWeightDevice { + // Major is the device's major number. + int64 Major = 1; + + // Minor is the device's minor number. + int64 Minor = 2; + + // Weight is the bandwidth rate for the device. + uint32 Weight = 3; + + // LeafWeight is the bandwidth rate for the device while competing with the cgroup's child cgroups, CFQ scheduler only + uint32 LeafWeight = 4; +} + +message LinuxThrottleDevice { + // Major is the device's major number. + int64 Major = 1; + + // Minor is the device's minor number. + int64 Minor = 2; + + // Rate is the IO rate limit per cgroup per device + uint64 Rate = 3; +} + +message LinuxBlockIO { + // Specifies per cgroup weight + uint32 Weight = 1; + + // Specifies tasks' weight in the given cgroup while competing with the cgroup's child cgroups, CFQ scheduler only + uint32 LeafWeight = 2; + + // Weight per cgroup per device, can override BlkioWeight + repeated LinuxWeightDevice WeightDevice = 3 [(gogoproto.nullable) = false]; + + // IO read rate limit per cgroup per device, bytes per second + repeated LinuxThrottleDevice ThrottleReadBpsDevice = 4 [(gogoproto.nullable) = false]; + + // IO write rate limit per cgroup per device, bytes per second + repeated LinuxThrottleDevice ThrottleWriteBpsDevice = 5 [(gogoproto.nullable) = false]; + + // IO read rate limit per cgroup per device, IO per second + repeated LinuxThrottleDevice ThrottleReadIOPSDevice = 6 [(gogoproto.nullable) = false]; + + // IO write rate limit per cgroup per device, IO per second + repeated LinuxThrottleDevice ThrottleWriteIOPSDevice = 7 [(gogoproto.nullable) = false]; +} + +message LinuxPids { + // Maximum number of PIDs. Default is "no limit". + int64 Limit = 1; +} + +message LinuxDeviceCgroup { + // Allow or deny + bool Allow = 1; + + // Device type, block, char, etc. + string Type = 2; + + // Major is the device's major number. + int64 Major = 3; + + // Minor is the device's minor number. + int64 Minor = 4; + + // Cgroup access permissions format, rwm. + string Access = 5; +} + +message LinuxNetwork { + // Set class identifier for container's network packets + uint32 ClassID = 1; + + // Set priority of network traffic for container + repeated LinuxInterfacePriority Priorities = 2 [(gogoproto.nullable) = false]; +} + +message LinuxHugepageLimit { + // Pagesize is the hugepage size + string Pagesize = 1; + + // Limit is the limit of "hugepagesize" hugetlb usage + uint64 Limit = 2; +} + +message LinuxInterfacePriority { + // Name is the name of the network interface + string Name = 1; + + // Priority for the interface + uint32 Priority = 2; +} + +message LinuxSeccomp { + string DefaultAction = 1; + repeated string Architectures = 2; + repeated LinuxSyscall Syscalls = 3 [(gogoproto.nullable) = false]; +} + +message LinuxSeccompArg { + uint64 Index = 1; + uint64 Value = 2; + uint64 ValueTwo = 3; + string Op = 4; +} + +message LinuxSyscall { + repeated string Names = 1; + string Action = 2; + repeated LinuxSeccompArg Args = 3 [(gogoproto.nullable) = false]; +} + +message LinuxIntelRdt { + // The schema for L3 cache id and capacity bitmask (CBM) + // Format: "L3:=;=;..." + string L3CacheSchema = 1; +} diff --git a/src/agent/protocols/src/agent.rs b/src/agent/protocols/src/agent.rs new file mode 100644 index 0000000000..c0181c79e4 --- /dev/null +++ b/src/agent/protocols/src/agent.rs @@ -0,0 +1,13671 @@ +// This file is generated by rust-protobuf 2.6.2. Do not edit +// @generated + +// https://github.com/Manishearth/rust-clippy/issues/702 +#![allow(unknown_lints)] +#![allow(clippy)] + +#![cfg_attr(rustfmt, rustfmt_skip)] + +#![allow(box_pointers)] +#![allow(dead_code)] +#![allow(missing_docs)] +#![allow(non_camel_case_types)] +#![allow(non_snake_case)] +#![allow(non_upper_case_globals)] +#![allow(trivial_casts)] +#![allow(unsafe_code)] +#![allow(unused_imports)] +#![allow(unused_results)] + +use protobuf::Message as Message_imported_for_functions; +use protobuf::ProtobufEnum as ProtobufEnum_imported_for_functions; + +#[derive(PartialEq,Clone,Default)] +pub struct CreateContainerRequest { + // message fields + pub container_id: ::std::string::String, + pub exec_id: ::std::string::String, + pub string_user: ::protobuf::SingularPtrField, + pub devices: ::protobuf::RepeatedField, + pub storages: ::protobuf::RepeatedField, + pub OCI: ::protobuf::SingularPtrField, + pub sandbox_pidns: bool, + // special fields + pub unknown_fields: ::protobuf::UnknownFields, + pub cached_size: ::protobuf::CachedSize, +} + +impl<'a> ::std::default::Default for &'a CreateContainerRequest { + fn default() -> &'a CreateContainerRequest { + ::default_instance() + } +} + +impl CreateContainerRequest { + pub fn new() -> CreateContainerRequest { + ::std::default::Default::default() + } + + // string container_id = 1; + + + pub fn get_container_id(&self) -> &str { + &self.container_id + } + pub fn clear_container_id(&mut self) { + self.container_id.clear(); + } + + // Param is passed by value, moved + pub fn set_container_id(&mut self, v: ::std::string::String) { + self.container_id = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_container_id(&mut self) -> &mut ::std::string::String { + &mut self.container_id + } + + // Take field + pub fn take_container_id(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.container_id, ::std::string::String::new()) + } + + // string exec_id = 2; + + + pub fn get_exec_id(&self) -> &str { + &self.exec_id + } + pub fn clear_exec_id(&mut self) { + self.exec_id.clear(); + } + + // Param is passed by value, moved + pub fn set_exec_id(&mut self, v: ::std::string::String) { + self.exec_id = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_exec_id(&mut self) -> &mut ::std::string::String { + &mut self.exec_id + } + + // Take field + pub fn take_exec_id(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.exec_id, ::std::string::String::new()) + } + + // .grpc.StringUser string_user = 3; + + + pub fn get_string_user(&self) -> &StringUser { + self.string_user.as_ref().unwrap_or_else(|| StringUser::default_instance()) + } + pub fn clear_string_user(&mut self) { + self.string_user.clear(); + } + + pub fn has_string_user(&self) -> bool { + self.string_user.is_some() + } + + // Param is passed by value, moved + pub fn set_string_user(&mut self, v: StringUser) { + self.string_user = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_string_user(&mut self) -> &mut StringUser { + if self.string_user.is_none() { + self.string_user.set_default(); + } + self.string_user.as_mut().unwrap() + } + + // Take field + pub fn take_string_user(&mut self) -> StringUser { + self.string_user.take().unwrap_or_else(|| StringUser::new()) + } + + // repeated .grpc.Device devices = 4; + + + pub fn get_devices(&self) -> &[Device] { + &self.devices + } + pub fn clear_devices(&mut self) { + self.devices.clear(); + } + + // Param is passed by value, moved + pub fn set_devices(&mut self, v: ::protobuf::RepeatedField) { + self.devices = v; + } + + // Mutable pointer to the field. + pub fn mut_devices(&mut self) -> &mut ::protobuf::RepeatedField { + &mut self.devices + } + + // Take field + pub fn take_devices(&mut self) -> ::protobuf::RepeatedField { + ::std::mem::replace(&mut self.devices, ::protobuf::RepeatedField::new()) + } + + // repeated .grpc.Storage storages = 5; + + + pub fn get_storages(&self) -> &[Storage] { + &self.storages + } + pub fn clear_storages(&mut self) { + self.storages.clear(); + } + + // Param is passed by value, moved + pub fn set_storages(&mut self, v: ::protobuf::RepeatedField) { + self.storages = v; + } + + // Mutable pointer to the field. + pub fn mut_storages(&mut self) -> &mut ::protobuf::RepeatedField { + &mut self.storages + } + + // Take field + pub fn take_storages(&mut self) -> ::protobuf::RepeatedField { + ::std::mem::replace(&mut self.storages, ::protobuf::RepeatedField::new()) + } + + // .grpc.Spec OCI = 6; + + + pub fn get_OCI(&self) -> &super::oci::Spec { + self.OCI.as_ref().unwrap_or_else(|| super::oci::Spec::default_instance()) + } + pub fn clear_OCI(&mut self) { + self.OCI.clear(); + } + + pub fn has_OCI(&self) -> bool { + self.OCI.is_some() + } + + // Param is passed by value, moved + pub fn set_OCI(&mut self, v: super::oci::Spec) { + self.OCI = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_OCI(&mut self) -> &mut super::oci::Spec { + if self.OCI.is_none() { + self.OCI.set_default(); + } + self.OCI.as_mut().unwrap() + } + + // Take field + pub fn take_OCI(&mut self) -> super::oci::Spec { + self.OCI.take().unwrap_or_else(|| super::oci::Spec::new()) + } + + // bool sandbox_pidns = 7; + + + pub fn get_sandbox_pidns(&self) -> bool { + self.sandbox_pidns + } + pub fn clear_sandbox_pidns(&mut self) { + self.sandbox_pidns = false; + } + + // Param is passed by value, moved + pub fn set_sandbox_pidns(&mut self, v: bool) { + self.sandbox_pidns = v; + } +} + +impl ::protobuf::Message for CreateContainerRequest { + fn is_initialized(&self) -> bool { + for v in &self.string_user { + if !v.is_initialized() { + return false; + } + }; + for v in &self.devices { + if !v.is_initialized() { + return false; + } + }; + for v in &self.storages { + if !v.is_initialized() { + return false; + } + }; + for v in &self.OCI { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.container_id)?; + }, + 2 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.exec_id)?; + }, + 3 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.string_user)?; + }, + 4 => { + ::protobuf::rt::read_repeated_message_into(wire_type, is, &mut self.devices)?; + }, + 5 => { + ::protobuf::rt::read_repeated_message_into(wire_type, is, &mut self.storages)?; + }, + 6 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.OCI)?; + }, + 7 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_bool()?; + self.sandbox_pidns = tmp; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if !self.container_id.is_empty() { + my_size += ::protobuf::rt::string_size(1, &self.container_id); + } + if !self.exec_id.is_empty() { + my_size += ::protobuf::rt::string_size(2, &self.exec_id); + } + if let Some(ref v) = self.string_user.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + for value in &self.devices { + let len = value.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + }; + for value in &self.storages { + let len = value.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + }; + if let Some(ref v) = self.OCI.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + if self.sandbox_pidns != false { + my_size += 2; + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if !self.container_id.is_empty() { + os.write_string(1, &self.container_id)?; + } + if !self.exec_id.is_empty() { + os.write_string(2, &self.exec_id)?; + } + if let Some(ref v) = self.string_user.as_ref() { + os.write_tag(3, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + for v in &self.devices { + os.write_tag(4, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + }; + for v in &self.storages { + os.write_tag(5, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + }; + if let Some(ref v) = self.OCI.as_ref() { + os.write_tag(6, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + if self.sandbox_pidns != false { + os.write_bool(7, self.sandbox_pidns)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> CreateContainerRequest { + CreateContainerRequest::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "container_id", + |m: &CreateContainerRequest| { &m.container_id }, + |m: &mut CreateContainerRequest| { &mut m.container_id }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "exec_id", + |m: &CreateContainerRequest| { &m.exec_id }, + |m: &mut CreateContainerRequest| { &mut m.exec_id }, + )); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "string_user", + |m: &CreateContainerRequest| { &m.string_user }, + |m: &mut CreateContainerRequest| { &mut m.string_user }, + )); + fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "devices", + |m: &CreateContainerRequest| { &m.devices }, + |m: &mut CreateContainerRequest| { &mut m.devices }, + )); + fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "storages", + |m: &CreateContainerRequest| { &m.storages }, + |m: &mut CreateContainerRequest| { &mut m.storages }, + )); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "OCI", + |m: &CreateContainerRequest| { &m.OCI }, + |m: &mut CreateContainerRequest| { &mut m.OCI }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeBool>( + "sandbox_pidns", + |m: &CreateContainerRequest| { &m.sandbox_pidns }, + |m: &mut CreateContainerRequest| { &mut m.sandbox_pidns }, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "CreateContainerRequest", + fields, + file_descriptor_proto() + ) + }) + } + } + + fn default_instance() -> &'static CreateContainerRequest { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const CreateContainerRequest, + }; + unsafe { + instance.get(CreateContainerRequest::new) + } + } +} + +impl ::protobuf::Clear for CreateContainerRequest { + fn clear(&mut self) { + self.container_id.clear(); + self.exec_id.clear(); + self.string_user.clear(); + self.devices.clear(); + self.storages.clear(); + self.OCI.clear(); + self.sandbox_pidns = false; + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for CreateContainerRequest { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for CreateContainerRequest { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct StartContainerRequest { + // message fields + pub container_id: ::std::string::String, + // special fields + pub unknown_fields: ::protobuf::UnknownFields, + pub cached_size: ::protobuf::CachedSize, +} + +impl<'a> ::std::default::Default for &'a StartContainerRequest { + fn default() -> &'a StartContainerRequest { + ::default_instance() + } +} + +impl StartContainerRequest { + pub fn new() -> StartContainerRequest { + ::std::default::Default::default() + } + + // string container_id = 1; + + + pub fn get_container_id(&self) -> &str { + &self.container_id + } + pub fn clear_container_id(&mut self) { + self.container_id.clear(); + } + + // Param is passed by value, moved + pub fn set_container_id(&mut self, v: ::std::string::String) { + self.container_id = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_container_id(&mut self) -> &mut ::std::string::String { + &mut self.container_id + } + + // Take field + pub fn take_container_id(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.container_id, ::std::string::String::new()) + } +} + +impl ::protobuf::Message for StartContainerRequest { + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.container_id)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if !self.container_id.is_empty() { + my_size += ::protobuf::rt::string_size(1, &self.container_id); + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if !self.container_id.is_empty() { + os.write_string(1, &self.container_id)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> StartContainerRequest { + StartContainerRequest::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "container_id", + |m: &StartContainerRequest| { &m.container_id }, + |m: &mut StartContainerRequest| { &mut m.container_id }, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "StartContainerRequest", + fields, + file_descriptor_proto() + ) + }) + } + } + + fn default_instance() -> &'static StartContainerRequest { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const StartContainerRequest, + }; + unsafe { + instance.get(StartContainerRequest::new) + } + } +} + +impl ::protobuf::Clear for StartContainerRequest { + fn clear(&mut self) { + self.container_id.clear(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for StartContainerRequest { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for StartContainerRequest { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct RemoveContainerRequest { + // message fields + pub container_id: ::std::string::String, + pub timeout: u32, + // special fields + pub unknown_fields: ::protobuf::UnknownFields, + pub cached_size: ::protobuf::CachedSize, +} + +impl<'a> ::std::default::Default for &'a RemoveContainerRequest { + fn default() -> &'a RemoveContainerRequest { + ::default_instance() + } +} + +impl RemoveContainerRequest { + pub fn new() -> RemoveContainerRequest { + ::std::default::Default::default() + } + + // string container_id = 1; + + + pub fn get_container_id(&self) -> &str { + &self.container_id + } + pub fn clear_container_id(&mut self) { + self.container_id.clear(); + } + + // Param is passed by value, moved + pub fn set_container_id(&mut self, v: ::std::string::String) { + self.container_id = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_container_id(&mut self) -> &mut ::std::string::String { + &mut self.container_id + } + + // Take field + pub fn take_container_id(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.container_id, ::std::string::String::new()) + } + + // uint32 timeout = 2; + + + pub fn get_timeout(&self) -> u32 { + self.timeout + } + pub fn clear_timeout(&mut self) { + self.timeout = 0; + } + + // Param is passed by value, moved + pub fn set_timeout(&mut self, v: u32) { + self.timeout = v; + } +} + +impl ::protobuf::Message for RemoveContainerRequest { + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.container_id)?; + }, + 2 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint32()?; + self.timeout = tmp; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if !self.container_id.is_empty() { + my_size += ::protobuf::rt::string_size(1, &self.container_id); + } + if self.timeout != 0 { + my_size += ::protobuf::rt::value_size(2, self.timeout, ::protobuf::wire_format::WireTypeVarint); + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if !self.container_id.is_empty() { + os.write_string(1, &self.container_id)?; + } + if self.timeout != 0 { + os.write_uint32(2, self.timeout)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> RemoveContainerRequest { + RemoveContainerRequest::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "container_id", + |m: &RemoveContainerRequest| { &m.container_id }, + |m: &mut RemoveContainerRequest| { &mut m.container_id }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint32>( + "timeout", + |m: &RemoveContainerRequest| { &m.timeout }, + |m: &mut RemoveContainerRequest| { &mut m.timeout }, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "RemoveContainerRequest", + fields, + file_descriptor_proto() + ) + }) + } + } + + fn default_instance() -> &'static RemoveContainerRequest { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const RemoveContainerRequest, + }; + unsafe { + instance.get(RemoveContainerRequest::new) + } + } +} + +impl ::protobuf::Clear for RemoveContainerRequest { + fn clear(&mut self) { + self.container_id.clear(); + self.timeout = 0; + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for RemoveContainerRequest { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for RemoveContainerRequest { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct ExecProcessRequest { + // message fields + pub container_id: ::std::string::String, + pub exec_id: ::std::string::String, + pub string_user: ::protobuf::SingularPtrField, + pub process: ::protobuf::SingularPtrField, + // special fields + pub unknown_fields: ::protobuf::UnknownFields, + pub cached_size: ::protobuf::CachedSize, +} + +impl<'a> ::std::default::Default for &'a ExecProcessRequest { + fn default() -> &'a ExecProcessRequest { + ::default_instance() + } +} + +impl ExecProcessRequest { + pub fn new() -> ExecProcessRequest { + ::std::default::Default::default() + } + + // string container_id = 1; + + + pub fn get_container_id(&self) -> &str { + &self.container_id + } + pub fn clear_container_id(&mut self) { + self.container_id.clear(); + } + + // Param is passed by value, moved + pub fn set_container_id(&mut self, v: ::std::string::String) { + self.container_id = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_container_id(&mut self) -> &mut ::std::string::String { + &mut self.container_id + } + + // Take field + pub fn take_container_id(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.container_id, ::std::string::String::new()) + } + + // string exec_id = 2; + + + pub fn get_exec_id(&self) -> &str { + &self.exec_id + } + pub fn clear_exec_id(&mut self) { + self.exec_id.clear(); + } + + // Param is passed by value, moved + pub fn set_exec_id(&mut self, v: ::std::string::String) { + self.exec_id = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_exec_id(&mut self) -> &mut ::std::string::String { + &mut self.exec_id + } + + // Take field + pub fn take_exec_id(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.exec_id, ::std::string::String::new()) + } + + // .grpc.StringUser string_user = 3; + + + pub fn get_string_user(&self) -> &StringUser { + self.string_user.as_ref().unwrap_or_else(|| StringUser::default_instance()) + } + pub fn clear_string_user(&mut self) { + self.string_user.clear(); + } + + pub fn has_string_user(&self) -> bool { + self.string_user.is_some() + } + + // Param is passed by value, moved + pub fn set_string_user(&mut self, v: StringUser) { + self.string_user = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_string_user(&mut self) -> &mut StringUser { + if self.string_user.is_none() { + self.string_user.set_default(); + } + self.string_user.as_mut().unwrap() + } + + // Take field + pub fn take_string_user(&mut self) -> StringUser { + self.string_user.take().unwrap_or_else(|| StringUser::new()) + } + + // .grpc.Process process = 4; + + + pub fn get_process(&self) -> &super::oci::Process { + self.process.as_ref().unwrap_or_else(|| super::oci::Process::default_instance()) + } + pub fn clear_process(&mut self) { + self.process.clear(); + } + + pub fn has_process(&self) -> bool { + self.process.is_some() + } + + // Param is passed by value, moved + pub fn set_process(&mut self, v: super::oci::Process) { + self.process = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_process(&mut self) -> &mut super::oci::Process { + if self.process.is_none() { + self.process.set_default(); + } + self.process.as_mut().unwrap() + } + + // Take field + pub fn take_process(&mut self) -> super::oci::Process { + self.process.take().unwrap_or_else(|| super::oci::Process::new()) + } +} + +impl ::protobuf::Message for ExecProcessRequest { + fn is_initialized(&self) -> bool { + for v in &self.string_user { + if !v.is_initialized() { + return false; + } + }; + for v in &self.process { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.container_id)?; + }, + 2 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.exec_id)?; + }, + 3 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.string_user)?; + }, + 4 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.process)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if !self.container_id.is_empty() { + my_size += ::protobuf::rt::string_size(1, &self.container_id); + } + if !self.exec_id.is_empty() { + my_size += ::protobuf::rt::string_size(2, &self.exec_id); + } + if let Some(ref v) = self.string_user.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + if let Some(ref v) = self.process.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if !self.container_id.is_empty() { + os.write_string(1, &self.container_id)?; + } + if !self.exec_id.is_empty() { + os.write_string(2, &self.exec_id)?; + } + if let Some(ref v) = self.string_user.as_ref() { + os.write_tag(3, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + if let Some(ref v) = self.process.as_ref() { + os.write_tag(4, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> ExecProcessRequest { + ExecProcessRequest::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "container_id", + |m: &ExecProcessRequest| { &m.container_id }, + |m: &mut ExecProcessRequest| { &mut m.container_id }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "exec_id", + |m: &ExecProcessRequest| { &m.exec_id }, + |m: &mut ExecProcessRequest| { &mut m.exec_id }, + )); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "string_user", + |m: &ExecProcessRequest| { &m.string_user }, + |m: &mut ExecProcessRequest| { &mut m.string_user }, + )); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "process", + |m: &ExecProcessRequest| { &m.process }, + |m: &mut ExecProcessRequest| { &mut m.process }, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "ExecProcessRequest", + fields, + file_descriptor_proto() + ) + }) + } + } + + fn default_instance() -> &'static ExecProcessRequest { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ExecProcessRequest, + }; + unsafe { + instance.get(ExecProcessRequest::new) + } + } +} + +impl ::protobuf::Clear for ExecProcessRequest { + fn clear(&mut self) { + self.container_id.clear(); + self.exec_id.clear(); + self.string_user.clear(); + self.process.clear(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for ExecProcessRequest { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for ExecProcessRequest { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct SignalProcessRequest { + // message fields + pub container_id: ::std::string::String, + pub exec_id: ::std::string::String, + pub signal: u32, + // special fields + pub unknown_fields: ::protobuf::UnknownFields, + pub cached_size: ::protobuf::CachedSize, +} + +impl<'a> ::std::default::Default for &'a SignalProcessRequest { + fn default() -> &'a SignalProcessRequest { + ::default_instance() + } +} + +impl SignalProcessRequest { + pub fn new() -> SignalProcessRequest { + ::std::default::Default::default() + } + + // string container_id = 1; + + + pub fn get_container_id(&self) -> &str { + &self.container_id + } + pub fn clear_container_id(&mut self) { + self.container_id.clear(); + } + + // Param is passed by value, moved + pub fn set_container_id(&mut self, v: ::std::string::String) { + self.container_id = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_container_id(&mut self) -> &mut ::std::string::String { + &mut self.container_id + } + + // Take field + pub fn take_container_id(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.container_id, ::std::string::String::new()) + } + + // string exec_id = 2; + + + pub fn get_exec_id(&self) -> &str { + &self.exec_id + } + pub fn clear_exec_id(&mut self) { + self.exec_id.clear(); + } + + // Param is passed by value, moved + pub fn set_exec_id(&mut self, v: ::std::string::String) { + self.exec_id = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_exec_id(&mut self) -> &mut ::std::string::String { + &mut self.exec_id + } + + // Take field + pub fn take_exec_id(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.exec_id, ::std::string::String::new()) + } + + // uint32 signal = 3; + + + pub fn get_signal(&self) -> u32 { + self.signal + } + pub fn clear_signal(&mut self) { + self.signal = 0; + } + + // Param is passed by value, moved + pub fn set_signal(&mut self, v: u32) { + self.signal = v; + } +} + +impl ::protobuf::Message for SignalProcessRequest { + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.container_id)?; + }, + 2 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.exec_id)?; + }, + 3 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint32()?; + self.signal = tmp; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if !self.container_id.is_empty() { + my_size += ::protobuf::rt::string_size(1, &self.container_id); + } + if !self.exec_id.is_empty() { + my_size += ::protobuf::rt::string_size(2, &self.exec_id); + } + if self.signal != 0 { + my_size += ::protobuf::rt::value_size(3, self.signal, ::protobuf::wire_format::WireTypeVarint); + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if !self.container_id.is_empty() { + os.write_string(1, &self.container_id)?; + } + if !self.exec_id.is_empty() { + os.write_string(2, &self.exec_id)?; + } + if self.signal != 0 { + os.write_uint32(3, self.signal)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> SignalProcessRequest { + SignalProcessRequest::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "container_id", + |m: &SignalProcessRequest| { &m.container_id }, + |m: &mut SignalProcessRequest| { &mut m.container_id }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "exec_id", + |m: &SignalProcessRequest| { &m.exec_id }, + |m: &mut SignalProcessRequest| { &mut m.exec_id }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint32>( + "signal", + |m: &SignalProcessRequest| { &m.signal }, + |m: &mut SignalProcessRequest| { &mut m.signal }, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "SignalProcessRequest", + fields, + file_descriptor_proto() + ) + }) + } + } + + fn default_instance() -> &'static SignalProcessRequest { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const SignalProcessRequest, + }; + unsafe { + instance.get(SignalProcessRequest::new) + } + } +} + +impl ::protobuf::Clear for SignalProcessRequest { + fn clear(&mut self) { + self.container_id.clear(); + self.exec_id.clear(); + self.signal = 0; + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for SignalProcessRequest { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for SignalProcessRequest { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct WaitProcessRequest { + // message fields + pub container_id: ::std::string::String, + pub exec_id: ::std::string::String, + // special fields + pub unknown_fields: ::protobuf::UnknownFields, + pub cached_size: ::protobuf::CachedSize, +} + +impl<'a> ::std::default::Default for &'a WaitProcessRequest { + fn default() -> &'a WaitProcessRequest { + ::default_instance() + } +} + +impl WaitProcessRequest { + pub fn new() -> WaitProcessRequest { + ::std::default::Default::default() + } + + // string container_id = 1; + + + pub fn get_container_id(&self) -> &str { + &self.container_id + } + pub fn clear_container_id(&mut self) { + self.container_id.clear(); + } + + // Param is passed by value, moved + pub fn set_container_id(&mut self, v: ::std::string::String) { + self.container_id = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_container_id(&mut self) -> &mut ::std::string::String { + &mut self.container_id + } + + // Take field + pub fn take_container_id(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.container_id, ::std::string::String::new()) + } + + // string exec_id = 2; + + + pub fn get_exec_id(&self) -> &str { + &self.exec_id + } + pub fn clear_exec_id(&mut self) { + self.exec_id.clear(); + } + + // Param is passed by value, moved + pub fn set_exec_id(&mut self, v: ::std::string::String) { + self.exec_id = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_exec_id(&mut self) -> &mut ::std::string::String { + &mut self.exec_id + } + + // Take field + pub fn take_exec_id(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.exec_id, ::std::string::String::new()) + } +} + +impl ::protobuf::Message for WaitProcessRequest { + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.container_id)?; + }, + 2 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.exec_id)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if !self.container_id.is_empty() { + my_size += ::protobuf::rt::string_size(1, &self.container_id); + } + if !self.exec_id.is_empty() { + my_size += ::protobuf::rt::string_size(2, &self.exec_id); + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if !self.container_id.is_empty() { + os.write_string(1, &self.container_id)?; + } + if !self.exec_id.is_empty() { + os.write_string(2, &self.exec_id)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> WaitProcessRequest { + WaitProcessRequest::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "container_id", + |m: &WaitProcessRequest| { &m.container_id }, + |m: &mut WaitProcessRequest| { &mut m.container_id }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "exec_id", + |m: &WaitProcessRequest| { &m.exec_id }, + |m: &mut WaitProcessRequest| { &mut m.exec_id }, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "WaitProcessRequest", + fields, + file_descriptor_proto() + ) + }) + } + } + + fn default_instance() -> &'static WaitProcessRequest { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const WaitProcessRequest, + }; + unsafe { + instance.get(WaitProcessRequest::new) + } + } +} + +impl ::protobuf::Clear for WaitProcessRequest { + fn clear(&mut self) { + self.container_id.clear(); + self.exec_id.clear(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for WaitProcessRequest { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for WaitProcessRequest { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct WaitProcessResponse { + // message fields + pub status: i32, + // special fields + pub unknown_fields: ::protobuf::UnknownFields, + pub cached_size: ::protobuf::CachedSize, +} + +impl<'a> ::std::default::Default for &'a WaitProcessResponse { + fn default() -> &'a WaitProcessResponse { + ::default_instance() + } +} + +impl WaitProcessResponse { + pub fn new() -> WaitProcessResponse { + ::std::default::Default::default() + } + + // int32 status = 1; + + + pub fn get_status(&self) -> i32 { + self.status + } + pub fn clear_status(&mut self) { + self.status = 0; + } + + // Param is passed by value, moved + pub fn set_status(&mut self, v: i32) { + self.status = v; + } +} + +impl ::protobuf::Message for WaitProcessResponse { + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_int32()?; + self.status = tmp; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if self.status != 0 { + my_size += ::protobuf::rt::value_size(1, self.status, ::protobuf::wire_format::WireTypeVarint); + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if self.status != 0 { + os.write_int32(1, self.status)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> WaitProcessResponse { + WaitProcessResponse::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeInt32>( + "status", + |m: &WaitProcessResponse| { &m.status }, + |m: &mut WaitProcessResponse| { &mut m.status }, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "WaitProcessResponse", + fields, + file_descriptor_proto() + ) + }) + } + } + + fn default_instance() -> &'static WaitProcessResponse { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const WaitProcessResponse, + }; + unsafe { + instance.get(WaitProcessResponse::new) + } + } +} + +impl ::protobuf::Clear for WaitProcessResponse { + fn clear(&mut self) { + self.status = 0; + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for WaitProcessResponse { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for WaitProcessResponse { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct ListProcessesRequest { + // message fields + pub container_id: ::std::string::String, + pub format: ::std::string::String, + pub args: ::protobuf::RepeatedField<::std::string::String>, + // special fields + pub unknown_fields: ::protobuf::UnknownFields, + pub cached_size: ::protobuf::CachedSize, +} + +impl<'a> ::std::default::Default for &'a ListProcessesRequest { + fn default() -> &'a ListProcessesRequest { + ::default_instance() + } +} + +impl ListProcessesRequest { + pub fn new() -> ListProcessesRequest { + ::std::default::Default::default() + } + + // string container_id = 1; + + + pub fn get_container_id(&self) -> &str { + &self.container_id + } + pub fn clear_container_id(&mut self) { + self.container_id.clear(); + } + + // Param is passed by value, moved + pub fn set_container_id(&mut self, v: ::std::string::String) { + self.container_id = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_container_id(&mut self) -> &mut ::std::string::String { + &mut self.container_id + } + + // Take field + pub fn take_container_id(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.container_id, ::std::string::String::new()) + } + + // string format = 2; + + + pub fn get_format(&self) -> &str { + &self.format + } + pub fn clear_format(&mut self) { + self.format.clear(); + } + + // Param is passed by value, moved + pub fn set_format(&mut self, v: ::std::string::String) { + self.format = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_format(&mut self) -> &mut ::std::string::String { + &mut self.format + } + + // Take field + pub fn take_format(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.format, ::std::string::String::new()) + } + + // repeated string args = 3; + + + pub fn get_args(&self) -> &[::std::string::String] { + &self.args + } + pub fn clear_args(&mut self) { + self.args.clear(); + } + + // Param is passed by value, moved + pub fn set_args(&mut self, v: ::protobuf::RepeatedField<::std::string::String>) { + self.args = v; + } + + // Mutable pointer to the field. + pub fn mut_args(&mut self) -> &mut ::protobuf::RepeatedField<::std::string::String> { + &mut self.args + } + + // Take field + pub fn take_args(&mut self) -> ::protobuf::RepeatedField<::std::string::String> { + ::std::mem::replace(&mut self.args, ::protobuf::RepeatedField::new()) + } +} + +impl ::protobuf::Message for ListProcessesRequest { + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.container_id)?; + }, + 2 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.format)?; + }, + 3 => { + ::protobuf::rt::read_repeated_string_into(wire_type, is, &mut self.args)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if !self.container_id.is_empty() { + my_size += ::protobuf::rt::string_size(1, &self.container_id); + } + if !self.format.is_empty() { + my_size += ::protobuf::rt::string_size(2, &self.format); + } + for value in &self.args { + my_size += ::protobuf::rt::string_size(3, &value); + }; + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if !self.container_id.is_empty() { + os.write_string(1, &self.container_id)?; + } + if !self.format.is_empty() { + os.write_string(2, &self.format)?; + } + for v in &self.args { + os.write_string(3, &v)?; + }; + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> ListProcessesRequest { + ListProcessesRequest::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "container_id", + |m: &ListProcessesRequest| { &m.container_id }, + |m: &mut ListProcessesRequest| { &mut m.container_id }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "format", + |m: &ListProcessesRequest| { &m.format }, + |m: &mut ListProcessesRequest| { &mut m.format }, + )); + fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "args", + |m: &ListProcessesRequest| { &m.args }, + |m: &mut ListProcessesRequest| { &mut m.args }, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "ListProcessesRequest", + fields, + file_descriptor_proto() + ) + }) + } + } + + fn default_instance() -> &'static ListProcessesRequest { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ListProcessesRequest, + }; + unsafe { + instance.get(ListProcessesRequest::new) + } + } +} + +impl ::protobuf::Clear for ListProcessesRequest { + fn clear(&mut self) { + self.container_id.clear(); + self.format.clear(); + self.args.clear(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for ListProcessesRequest { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for ListProcessesRequest { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct ListProcessesResponse { + // message fields + pub process_list: ::std::vec::Vec, + // special fields + pub unknown_fields: ::protobuf::UnknownFields, + pub cached_size: ::protobuf::CachedSize, +} + +impl<'a> ::std::default::Default for &'a ListProcessesResponse { + fn default() -> &'a ListProcessesResponse { + ::default_instance() + } +} + +impl ListProcessesResponse { + pub fn new() -> ListProcessesResponse { + ::std::default::Default::default() + } + + // bytes process_list = 1; + + + pub fn get_process_list(&self) -> &[u8] { + &self.process_list + } + pub fn clear_process_list(&mut self) { + self.process_list.clear(); + } + + // Param is passed by value, moved + pub fn set_process_list(&mut self, v: ::std::vec::Vec) { + self.process_list = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_process_list(&mut self) -> &mut ::std::vec::Vec { + &mut self.process_list + } + + // Take field + pub fn take_process_list(&mut self) -> ::std::vec::Vec { + ::std::mem::replace(&mut self.process_list, ::std::vec::Vec::new()) + } +} + +impl ::protobuf::Message for ListProcessesResponse { + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_proto3_bytes_into(wire_type, is, &mut self.process_list)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if !self.process_list.is_empty() { + my_size += ::protobuf::rt::bytes_size(1, &self.process_list); + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if !self.process_list.is_empty() { + os.write_bytes(1, &self.process_list)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> ListProcessesResponse { + ListProcessesResponse::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( + "process_list", + |m: &ListProcessesResponse| { &m.process_list }, + |m: &mut ListProcessesResponse| { &mut m.process_list }, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "ListProcessesResponse", + fields, + file_descriptor_proto() + ) + }) + } + } + + fn default_instance() -> &'static ListProcessesResponse { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ListProcessesResponse, + }; + unsafe { + instance.get(ListProcessesResponse::new) + } + } +} + +impl ::protobuf::Clear for ListProcessesResponse { + fn clear(&mut self) { + self.process_list.clear(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for ListProcessesResponse { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for ListProcessesResponse { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct UpdateContainerRequest { + // message fields + pub container_id: ::std::string::String, + pub resources: ::protobuf::SingularPtrField, + // special fields + pub unknown_fields: ::protobuf::UnknownFields, + pub cached_size: ::protobuf::CachedSize, +} + +impl<'a> ::std::default::Default for &'a UpdateContainerRequest { + fn default() -> &'a UpdateContainerRequest { + ::default_instance() + } +} + +impl UpdateContainerRequest { + pub fn new() -> UpdateContainerRequest { + ::std::default::Default::default() + } + + // string container_id = 1; + + + pub fn get_container_id(&self) -> &str { + &self.container_id + } + pub fn clear_container_id(&mut self) { + self.container_id.clear(); + } + + // Param is passed by value, moved + pub fn set_container_id(&mut self, v: ::std::string::String) { + self.container_id = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_container_id(&mut self) -> &mut ::std::string::String { + &mut self.container_id + } + + // Take field + pub fn take_container_id(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.container_id, ::std::string::String::new()) + } + + // .grpc.LinuxResources resources = 2; + + + pub fn get_resources(&self) -> &super::oci::LinuxResources { + self.resources.as_ref().unwrap_or_else(|| super::oci::LinuxResources::default_instance()) + } + pub fn clear_resources(&mut self) { + self.resources.clear(); + } + + pub fn has_resources(&self) -> bool { + self.resources.is_some() + } + + // Param is passed by value, moved + pub fn set_resources(&mut self, v: super::oci::LinuxResources) { + self.resources = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_resources(&mut self) -> &mut super::oci::LinuxResources { + if self.resources.is_none() { + self.resources.set_default(); + } + self.resources.as_mut().unwrap() + } + + // Take field + pub fn take_resources(&mut self) -> super::oci::LinuxResources { + self.resources.take().unwrap_or_else(|| super::oci::LinuxResources::new()) + } +} + +impl ::protobuf::Message for UpdateContainerRequest { + fn is_initialized(&self) -> bool { + for v in &self.resources { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.container_id)?; + }, + 2 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.resources)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if !self.container_id.is_empty() { + my_size += ::protobuf::rt::string_size(1, &self.container_id); + } + if let Some(ref v) = self.resources.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if !self.container_id.is_empty() { + os.write_string(1, &self.container_id)?; + } + if let Some(ref v) = self.resources.as_ref() { + os.write_tag(2, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> UpdateContainerRequest { + UpdateContainerRequest::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "container_id", + |m: &UpdateContainerRequest| { &m.container_id }, + |m: &mut UpdateContainerRequest| { &mut m.container_id }, + )); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "resources", + |m: &UpdateContainerRequest| { &m.resources }, + |m: &mut UpdateContainerRequest| { &mut m.resources }, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "UpdateContainerRequest", + fields, + file_descriptor_proto() + ) + }) + } + } + + fn default_instance() -> &'static UpdateContainerRequest { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const UpdateContainerRequest, + }; + unsafe { + instance.get(UpdateContainerRequest::new) + } + } +} + +impl ::protobuf::Clear for UpdateContainerRequest { + fn clear(&mut self) { + self.container_id.clear(); + self.resources.clear(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for UpdateContainerRequest { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for UpdateContainerRequest { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct StatsContainerRequest { + // message fields + pub container_id: ::std::string::String, + // special fields + pub unknown_fields: ::protobuf::UnknownFields, + pub cached_size: ::protobuf::CachedSize, +} + +impl<'a> ::std::default::Default for &'a StatsContainerRequest { + fn default() -> &'a StatsContainerRequest { + ::default_instance() + } +} + +impl StatsContainerRequest { + pub fn new() -> StatsContainerRequest { + ::std::default::Default::default() + } + + // string container_id = 1; + + + pub fn get_container_id(&self) -> &str { + &self.container_id + } + pub fn clear_container_id(&mut self) { + self.container_id.clear(); + } + + // Param is passed by value, moved + pub fn set_container_id(&mut self, v: ::std::string::String) { + self.container_id = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_container_id(&mut self) -> &mut ::std::string::String { + &mut self.container_id + } + + // Take field + pub fn take_container_id(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.container_id, ::std::string::String::new()) + } +} + +impl ::protobuf::Message for StatsContainerRequest { + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.container_id)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if !self.container_id.is_empty() { + my_size += ::protobuf::rt::string_size(1, &self.container_id); + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if !self.container_id.is_empty() { + os.write_string(1, &self.container_id)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> StatsContainerRequest { + StatsContainerRequest::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "container_id", + |m: &StatsContainerRequest| { &m.container_id }, + |m: &mut StatsContainerRequest| { &mut m.container_id }, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "StatsContainerRequest", + fields, + file_descriptor_proto() + ) + }) + } + } + + fn default_instance() -> &'static StatsContainerRequest { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const StatsContainerRequest, + }; + unsafe { + instance.get(StatsContainerRequest::new) + } + } +} + +impl ::protobuf::Clear for StatsContainerRequest { + fn clear(&mut self) { + self.container_id.clear(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for StatsContainerRequest { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for StatsContainerRequest { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct PauseContainerRequest { + // message fields + pub container_id: ::std::string::String, + // special fields + pub unknown_fields: ::protobuf::UnknownFields, + pub cached_size: ::protobuf::CachedSize, +} + +impl<'a> ::std::default::Default for &'a PauseContainerRequest { + fn default() -> &'a PauseContainerRequest { + ::default_instance() + } +} + +impl PauseContainerRequest { + pub fn new() -> PauseContainerRequest { + ::std::default::Default::default() + } + + // string container_id = 1; + + + pub fn get_container_id(&self) -> &str { + &self.container_id + } + pub fn clear_container_id(&mut self) { + self.container_id.clear(); + } + + // Param is passed by value, moved + pub fn set_container_id(&mut self, v: ::std::string::String) { + self.container_id = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_container_id(&mut self) -> &mut ::std::string::String { + &mut self.container_id + } + + // Take field + pub fn take_container_id(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.container_id, ::std::string::String::new()) + } +} + +impl ::protobuf::Message for PauseContainerRequest { + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.container_id)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if !self.container_id.is_empty() { + my_size += ::protobuf::rt::string_size(1, &self.container_id); + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if !self.container_id.is_empty() { + os.write_string(1, &self.container_id)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> PauseContainerRequest { + PauseContainerRequest::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "container_id", + |m: &PauseContainerRequest| { &m.container_id }, + |m: &mut PauseContainerRequest| { &mut m.container_id }, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "PauseContainerRequest", + fields, + file_descriptor_proto() + ) + }) + } + } + + fn default_instance() -> &'static PauseContainerRequest { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const PauseContainerRequest, + }; + unsafe { + instance.get(PauseContainerRequest::new) + } + } +} + +impl ::protobuf::Clear for PauseContainerRequest { + fn clear(&mut self) { + self.container_id.clear(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for PauseContainerRequest { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for PauseContainerRequest { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct ResumeContainerRequest { + // message fields + pub container_id: ::std::string::String, + // special fields + pub unknown_fields: ::protobuf::UnknownFields, + pub cached_size: ::protobuf::CachedSize, +} + +impl<'a> ::std::default::Default for &'a ResumeContainerRequest { + fn default() -> &'a ResumeContainerRequest { + ::default_instance() + } +} + +impl ResumeContainerRequest { + pub fn new() -> ResumeContainerRequest { + ::std::default::Default::default() + } + + // string container_id = 1; + + + pub fn get_container_id(&self) -> &str { + &self.container_id + } + pub fn clear_container_id(&mut self) { + self.container_id.clear(); + } + + // Param is passed by value, moved + pub fn set_container_id(&mut self, v: ::std::string::String) { + self.container_id = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_container_id(&mut self) -> &mut ::std::string::String { + &mut self.container_id + } + + // Take field + pub fn take_container_id(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.container_id, ::std::string::String::new()) + } +} + +impl ::protobuf::Message for ResumeContainerRequest { + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.container_id)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if !self.container_id.is_empty() { + my_size += ::protobuf::rt::string_size(1, &self.container_id); + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if !self.container_id.is_empty() { + os.write_string(1, &self.container_id)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> ResumeContainerRequest { + ResumeContainerRequest::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "container_id", + |m: &ResumeContainerRequest| { &m.container_id }, + |m: &mut ResumeContainerRequest| { &mut m.container_id }, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "ResumeContainerRequest", + fields, + file_descriptor_proto() + ) + }) + } + } + + fn default_instance() -> &'static ResumeContainerRequest { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ResumeContainerRequest, + }; + unsafe { + instance.get(ResumeContainerRequest::new) + } + } +} + +impl ::protobuf::Clear for ResumeContainerRequest { + fn clear(&mut self) { + self.container_id.clear(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for ResumeContainerRequest { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for ResumeContainerRequest { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct CpuUsage { + // message fields + pub total_usage: u64, + pub percpu_usage: ::std::vec::Vec, + pub usage_in_kernelmode: u64, + pub usage_in_usermode: u64, + // special fields + pub unknown_fields: ::protobuf::UnknownFields, + pub cached_size: ::protobuf::CachedSize, +} + +impl<'a> ::std::default::Default for &'a CpuUsage { + fn default() -> &'a CpuUsage { + ::default_instance() + } +} + +impl CpuUsage { + pub fn new() -> CpuUsage { + ::std::default::Default::default() + } + + // uint64 total_usage = 1; + + + pub fn get_total_usage(&self) -> u64 { + self.total_usage + } + pub fn clear_total_usage(&mut self) { + self.total_usage = 0; + } + + // Param is passed by value, moved + pub fn set_total_usage(&mut self, v: u64) { + self.total_usage = v; + } + + // repeated uint64 percpu_usage = 2; + + + pub fn get_percpu_usage(&self) -> &[u64] { + &self.percpu_usage + } + pub fn clear_percpu_usage(&mut self) { + self.percpu_usage.clear(); + } + + // Param is passed by value, moved + pub fn set_percpu_usage(&mut self, v: ::std::vec::Vec) { + self.percpu_usage = v; + } + + // Mutable pointer to the field. + pub fn mut_percpu_usage(&mut self) -> &mut ::std::vec::Vec { + &mut self.percpu_usage + } + + // Take field + pub fn take_percpu_usage(&mut self) -> ::std::vec::Vec { + ::std::mem::replace(&mut self.percpu_usage, ::std::vec::Vec::new()) + } + + // uint64 usage_in_kernelmode = 3; + + + pub fn get_usage_in_kernelmode(&self) -> u64 { + self.usage_in_kernelmode + } + pub fn clear_usage_in_kernelmode(&mut self) { + self.usage_in_kernelmode = 0; + } + + // Param is passed by value, moved + pub fn set_usage_in_kernelmode(&mut self, v: u64) { + self.usage_in_kernelmode = v; + } + + // uint64 usage_in_usermode = 4; + + + pub fn get_usage_in_usermode(&self) -> u64 { + self.usage_in_usermode + } + pub fn clear_usage_in_usermode(&mut self) { + self.usage_in_usermode = 0; + } + + // Param is passed by value, moved + pub fn set_usage_in_usermode(&mut self, v: u64) { + self.usage_in_usermode = v; + } +} + +impl ::protobuf::Message for CpuUsage { + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint64()?; + self.total_usage = tmp; + }, + 2 => { + ::protobuf::rt::read_repeated_uint64_into(wire_type, is, &mut self.percpu_usage)?; + }, + 3 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint64()?; + self.usage_in_kernelmode = tmp; + }, + 4 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint64()?; + self.usage_in_usermode = tmp; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if self.total_usage != 0 { + my_size += ::protobuf::rt::value_size(1, self.total_usage, ::protobuf::wire_format::WireTypeVarint); + } + for value in &self.percpu_usage { + my_size += ::protobuf::rt::value_size(2, *value, ::protobuf::wire_format::WireTypeVarint); + }; + if self.usage_in_kernelmode != 0 { + my_size += ::protobuf::rt::value_size(3, self.usage_in_kernelmode, ::protobuf::wire_format::WireTypeVarint); + } + if self.usage_in_usermode != 0 { + my_size += ::protobuf::rt::value_size(4, self.usage_in_usermode, ::protobuf::wire_format::WireTypeVarint); + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if self.total_usage != 0 { + os.write_uint64(1, self.total_usage)?; + } + for v in &self.percpu_usage { + os.write_uint64(2, *v)?; + }; + if self.usage_in_kernelmode != 0 { + os.write_uint64(3, self.usage_in_kernelmode)?; + } + if self.usage_in_usermode != 0 { + os.write_uint64(4, self.usage_in_usermode)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> CpuUsage { + CpuUsage::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( + "total_usage", + |m: &CpuUsage| { &m.total_usage }, + |m: &mut CpuUsage| { &mut m.total_usage }, + )); + fields.push(::protobuf::reflect::accessor::make_vec_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( + "percpu_usage", + |m: &CpuUsage| { &m.percpu_usage }, + |m: &mut CpuUsage| { &mut m.percpu_usage }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( + "usage_in_kernelmode", + |m: &CpuUsage| { &m.usage_in_kernelmode }, + |m: &mut CpuUsage| { &mut m.usage_in_kernelmode }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( + "usage_in_usermode", + |m: &CpuUsage| { &m.usage_in_usermode }, + |m: &mut CpuUsage| { &mut m.usage_in_usermode }, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "CpuUsage", + fields, + file_descriptor_proto() + ) + }) + } + } + + fn default_instance() -> &'static CpuUsage { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const CpuUsage, + }; + unsafe { + instance.get(CpuUsage::new) + } + } +} + +impl ::protobuf::Clear for CpuUsage { + fn clear(&mut self) { + self.total_usage = 0; + self.percpu_usage.clear(); + self.usage_in_kernelmode = 0; + self.usage_in_usermode = 0; + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for CpuUsage { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for CpuUsage { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct ThrottlingData { + // message fields + pub periods: u64, + pub throttled_periods: u64, + pub throttled_time: u64, + // special fields + pub unknown_fields: ::protobuf::UnknownFields, + pub cached_size: ::protobuf::CachedSize, +} + +impl<'a> ::std::default::Default for &'a ThrottlingData { + fn default() -> &'a ThrottlingData { + ::default_instance() + } +} + +impl ThrottlingData { + pub fn new() -> ThrottlingData { + ::std::default::Default::default() + } + + // uint64 periods = 1; + + + pub fn get_periods(&self) -> u64 { + self.periods + } + pub fn clear_periods(&mut self) { + self.periods = 0; + } + + // Param is passed by value, moved + pub fn set_periods(&mut self, v: u64) { + self.periods = v; + } + + // uint64 throttled_periods = 2; + + + pub fn get_throttled_periods(&self) -> u64 { + self.throttled_periods + } + pub fn clear_throttled_periods(&mut self) { + self.throttled_periods = 0; + } + + // Param is passed by value, moved + pub fn set_throttled_periods(&mut self, v: u64) { + self.throttled_periods = v; + } + + // uint64 throttled_time = 3; + + + pub fn get_throttled_time(&self) -> u64 { + self.throttled_time + } + pub fn clear_throttled_time(&mut self) { + self.throttled_time = 0; + } + + // Param is passed by value, moved + pub fn set_throttled_time(&mut self, v: u64) { + self.throttled_time = v; + } +} + +impl ::protobuf::Message for ThrottlingData { + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint64()?; + self.periods = tmp; + }, + 2 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint64()?; + self.throttled_periods = tmp; + }, + 3 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint64()?; + self.throttled_time = tmp; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if self.periods != 0 { + my_size += ::protobuf::rt::value_size(1, self.periods, ::protobuf::wire_format::WireTypeVarint); + } + if self.throttled_periods != 0 { + my_size += ::protobuf::rt::value_size(2, self.throttled_periods, ::protobuf::wire_format::WireTypeVarint); + } + if self.throttled_time != 0 { + my_size += ::protobuf::rt::value_size(3, self.throttled_time, ::protobuf::wire_format::WireTypeVarint); + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if self.periods != 0 { + os.write_uint64(1, self.periods)?; + } + if self.throttled_periods != 0 { + os.write_uint64(2, self.throttled_periods)?; + } + if self.throttled_time != 0 { + os.write_uint64(3, self.throttled_time)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> ThrottlingData { + ThrottlingData::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( + "periods", + |m: &ThrottlingData| { &m.periods }, + |m: &mut ThrottlingData| { &mut m.periods }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( + "throttled_periods", + |m: &ThrottlingData| { &m.throttled_periods }, + |m: &mut ThrottlingData| { &mut m.throttled_periods }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( + "throttled_time", + |m: &ThrottlingData| { &m.throttled_time }, + |m: &mut ThrottlingData| { &mut m.throttled_time }, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "ThrottlingData", + fields, + file_descriptor_proto() + ) + }) + } + } + + fn default_instance() -> &'static ThrottlingData { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ThrottlingData, + }; + unsafe { + instance.get(ThrottlingData::new) + } + } +} + +impl ::protobuf::Clear for ThrottlingData { + fn clear(&mut self) { + self.periods = 0; + self.throttled_periods = 0; + self.throttled_time = 0; + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for ThrottlingData { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for ThrottlingData { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct CpuStats { + // message fields + pub cpu_usage: ::protobuf::SingularPtrField, + pub throttling_data: ::protobuf::SingularPtrField, + // special fields + pub unknown_fields: ::protobuf::UnknownFields, + pub cached_size: ::protobuf::CachedSize, +} + +impl<'a> ::std::default::Default for &'a CpuStats { + fn default() -> &'a CpuStats { + ::default_instance() + } +} + +impl CpuStats { + pub fn new() -> CpuStats { + ::std::default::Default::default() + } + + // .grpc.CpuUsage cpu_usage = 1; + + + pub fn get_cpu_usage(&self) -> &CpuUsage { + self.cpu_usage.as_ref().unwrap_or_else(|| CpuUsage::default_instance()) + } + pub fn clear_cpu_usage(&mut self) { + self.cpu_usage.clear(); + } + + pub fn has_cpu_usage(&self) -> bool { + self.cpu_usage.is_some() + } + + // Param is passed by value, moved + pub fn set_cpu_usage(&mut self, v: CpuUsage) { + self.cpu_usage = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_cpu_usage(&mut self) -> &mut CpuUsage { + if self.cpu_usage.is_none() { + self.cpu_usage.set_default(); + } + self.cpu_usage.as_mut().unwrap() + } + + // Take field + pub fn take_cpu_usage(&mut self) -> CpuUsage { + self.cpu_usage.take().unwrap_or_else(|| CpuUsage::new()) + } + + // .grpc.ThrottlingData throttling_data = 2; + + + pub fn get_throttling_data(&self) -> &ThrottlingData { + self.throttling_data.as_ref().unwrap_or_else(|| ThrottlingData::default_instance()) + } + pub fn clear_throttling_data(&mut self) { + self.throttling_data.clear(); + } + + pub fn has_throttling_data(&self) -> bool { + self.throttling_data.is_some() + } + + // Param is passed by value, moved + pub fn set_throttling_data(&mut self, v: ThrottlingData) { + self.throttling_data = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_throttling_data(&mut self) -> &mut ThrottlingData { + if self.throttling_data.is_none() { + self.throttling_data.set_default(); + } + self.throttling_data.as_mut().unwrap() + } + + // Take field + pub fn take_throttling_data(&mut self) -> ThrottlingData { + self.throttling_data.take().unwrap_or_else(|| ThrottlingData::new()) + } +} + +impl ::protobuf::Message for CpuStats { + fn is_initialized(&self) -> bool { + for v in &self.cpu_usage { + if !v.is_initialized() { + return false; + } + }; + for v in &self.throttling_data { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.cpu_usage)?; + }, + 2 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.throttling_data)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if let Some(ref v) = self.cpu_usage.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + if let Some(ref v) = self.throttling_data.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if let Some(ref v) = self.cpu_usage.as_ref() { + os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + if let Some(ref v) = self.throttling_data.as_ref() { + os.write_tag(2, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> CpuStats { + CpuStats::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "cpu_usage", + |m: &CpuStats| { &m.cpu_usage }, + |m: &mut CpuStats| { &mut m.cpu_usage }, + )); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "throttling_data", + |m: &CpuStats| { &m.throttling_data }, + |m: &mut CpuStats| { &mut m.throttling_data }, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "CpuStats", + fields, + file_descriptor_proto() + ) + }) + } + } + + fn default_instance() -> &'static CpuStats { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const CpuStats, + }; + unsafe { + instance.get(CpuStats::new) + } + } +} + +impl ::protobuf::Clear for CpuStats { + fn clear(&mut self) { + self.cpu_usage.clear(); + self.throttling_data.clear(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for CpuStats { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for CpuStats { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct PidsStats { + // message fields + pub current: u64, + pub limit: u64, + // special fields + pub unknown_fields: ::protobuf::UnknownFields, + pub cached_size: ::protobuf::CachedSize, +} + +impl<'a> ::std::default::Default for &'a PidsStats { + fn default() -> &'a PidsStats { + ::default_instance() + } +} + +impl PidsStats { + pub fn new() -> PidsStats { + ::std::default::Default::default() + } + + // uint64 current = 1; + + + pub fn get_current(&self) -> u64 { + self.current + } + pub fn clear_current(&mut self) { + self.current = 0; + } + + // Param is passed by value, moved + pub fn set_current(&mut self, v: u64) { + self.current = v; + } + + // uint64 limit = 2; + + + pub fn get_limit(&self) -> u64 { + self.limit + } + pub fn clear_limit(&mut self) { + self.limit = 0; + } + + // Param is passed by value, moved + pub fn set_limit(&mut self, v: u64) { + self.limit = v; + } +} + +impl ::protobuf::Message for PidsStats { + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint64()?; + self.current = tmp; + }, + 2 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint64()?; + self.limit = tmp; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if self.current != 0 { + my_size += ::protobuf::rt::value_size(1, self.current, ::protobuf::wire_format::WireTypeVarint); + } + if self.limit != 0 { + my_size += ::protobuf::rt::value_size(2, self.limit, ::protobuf::wire_format::WireTypeVarint); + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if self.current != 0 { + os.write_uint64(1, self.current)?; + } + if self.limit != 0 { + os.write_uint64(2, self.limit)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> PidsStats { + PidsStats::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( + "current", + |m: &PidsStats| { &m.current }, + |m: &mut PidsStats| { &mut m.current }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( + "limit", + |m: &PidsStats| { &m.limit }, + |m: &mut PidsStats| { &mut m.limit }, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "PidsStats", + fields, + file_descriptor_proto() + ) + }) + } + } + + fn default_instance() -> &'static PidsStats { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const PidsStats, + }; + unsafe { + instance.get(PidsStats::new) + } + } +} + +impl ::protobuf::Clear for PidsStats { + fn clear(&mut self) { + self.current = 0; + self.limit = 0; + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for PidsStats { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for PidsStats { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct MemoryData { + // message fields + pub usage: u64, + pub max_usage: u64, + pub failcnt: u64, + pub limit: u64, + // special fields + pub unknown_fields: ::protobuf::UnknownFields, + pub cached_size: ::protobuf::CachedSize, +} + +impl<'a> ::std::default::Default for &'a MemoryData { + fn default() -> &'a MemoryData { + ::default_instance() + } +} + +impl MemoryData { + pub fn new() -> MemoryData { + ::std::default::Default::default() + } + + // uint64 usage = 1; + + + pub fn get_usage(&self) -> u64 { + self.usage + } + pub fn clear_usage(&mut self) { + self.usage = 0; + } + + // Param is passed by value, moved + pub fn set_usage(&mut self, v: u64) { + self.usage = v; + } + + // uint64 max_usage = 2; + + + pub fn get_max_usage(&self) -> u64 { + self.max_usage + } + pub fn clear_max_usage(&mut self) { + self.max_usage = 0; + } + + // Param is passed by value, moved + pub fn set_max_usage(&mut self, v: u64) { + self.max_usage = v; + } + + // uint64 failcnt = 3; + + + pub fn get_failcnt(&self) -> u64 { + self.failcnt + } + pub fn clear_failcnt(&mut self) { + self.failcnt = 0; + } + + // Param is passed by value, moved + pub fn set_failcnt(&mut self, v: u64) { + self.failcnt = v; + } + + // uint64 limit = 4; + + + pub fn get_limit(&self) -> u64 { + self.limit + } + pub fn clear_limit(&mut self) { + self.limit = 0; + } + + // Param is passed by value, moved + pub fn set_limit(&mut self, v: u64) { + self.limit = v; + } +} + +impl ::protobuf::Message for MemoryData { + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint64()?; + self.usage = tmp; + }, + 2 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint64()?; + self.max_usage = tmp; + }, + 3 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint64()?; + self.failcnt = tmp; + }, + 4 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint64()?; + self.limit = tmp; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if self.usage != 0 { + my_size += ::protobuf::rt::value_size(1, self.usage, ::protobuf::wire_format::WireTypeVarint); + } + if self.max_usage != 0 { + my_size += ::protobuf::rt::value_size(2, self.max_usage, ::protobuf::wire_format::WireTypeVarint); + } + if self.failcnt != 0 { + my_size += ::protobuf::rt::value_size(3, self.failcnt, ::protobuf::wire_format::WireTypeVarint); + } + if self.limit != 0 { + my_size += ::protobuf::rt::value_size(4, self.limit, ::protobuf::wire_format::WireTypeVarint); + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if self.usage != 0 { + os.write_uint64(1, self.usage)?; + } + if self.max_usage != 0 { + os.write_uint64(2, self.max_usage)?; + } + if self.failcnt != 0 { + os.write_uint64(3, self.failcnt)?; + } + if self.limit != 0 { + os.write_uint64(4, self.limit)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> MemoryData { + MemoryData::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( + "usage", + |m: &MemoryData| { &m.usage }, + |m: &mut MemoryData| { &mut m.usage }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( + "max_usage", + |m: &MemoryData| { &m.max_usage }, + |m: &mut MemoryData| { &mut m.max_usage }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( + "failcnt", + |m: &MemoryData| { &m.failcnt }, + |m: &mut MemoryData| { &mut m.failcnt }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( + "limit", + |m: &MemoryData| { &m.limit }, + |m: &mut MemoryData| { &mut m.limit }, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "MemoryData", + fields, + file_descriptor_proto() + ) + }) + } + } + + fn default_instance() -> &'static MemoryData { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const MemoryData, + }; + unsafe { + instance.get(MemoryData::new) + } + } +} + +impl ::protobuf::Clear for MemoryData { + fn clear(&mut self) { + self.usage = 0; + self.max_usage = 0; + self.failcnt = 0; + self.limit = 0; + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for MemoryData { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for MemoryData { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct MemoryStats { + // message fields + pub cache: u64, + pub usage: ::protobuf::SingularPtrField, + pub swap_usage: ::protobuf::SingularPtrField, + pub kernel_usage: ::protobuf::SingularPtrField, + pub use_hierarchy: bool, + pub stats: ::std::collections::HashMap<::std::string::String, u64>, + // special fields + pub unknown_fields: ::protobuf::UnknownFields, + pub cached_size: ::protobuf::CachedSize, +} + +impl<'a> ::std::default::Default for &'a MemoryStats { + fn default() -> &'a MemoryStats { + ::default_instance() + } +} + +impl MemoryStats { + pub fn new() -> MemoryStats { + ::std::default::Default::default() + } + + // uint64 cache = 1; + + + pub fn get_cache(&self) -> u64 { + self.cache + } + pub fn clear_cache(&mut self) { + self.cache = 0; + } + + // Param is passed by value, moved + pub fn set_cache(&mut self, v: u64) { + self.cache = v; + } + + // .grpc.MemoryData usage = 2; + + + pub fn get_usage(&self) -> &MemoryData { + self.usage.as_ref().unwrap_or_else(|| MemoryData::default_instance()) + } + pub fn clear_usage(&mut self) { + self.usage.clear(); + } + + pub fn has_usage(&self) -> bool { + self.usage.is_some() + } + + // Param is passed by value, moved + pub fn set_usage(&mut self, v: MemoryData) { + self.usage = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_usage(&mut self) -> &mut MemoryData { + if self.usage.is_none() { + self.usage.set_default(); + } + self.usage.as_mut().unwrap() + } + + // Take field + pub fn take_usage(&mut self) -> MemoryData { + self.usage.take().unwrap_or_else(|| MemoryData::new()) + } + + // .grpc.MemoryData swap_usage = 3; + + + pub fn get_swap_usage(&self) -> &MemoryData { + self.swap_usage.as_ref().unwrap_or_else(|| MemoryData::default_instance()) + } + pub fn clear_swap_usage(&mut self) { + self.swap_usage.clear(); + } + + pub fn has_swap_usage(&self) -> bool { + self.swap_usage.is_some() + } + + // Param is passed by value, moved + pub fn set_swap_usage(&mut self, v: MemoryData) { + self.swap_usage = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_swap_usage(&mut self) -> &mut MemoryData { + if self.swap_usage.is_none() { + self.swap_usage.set_default(); + } + self.swap_usage.as_mut().unwrap() + } + + // Take field + pub fn take_swap_usage(&mut self) -> MemoryData { + self.swap_usage.take().unwrap_or_else(|| MemoryData::new()) + } + + // .grpc.MemoryData kernel_usage = 4; + + + pub fn get_kernel_usage(&self) -> &MemoryData { + self.kernel_usage.as_ref().unwrap_or_else(|| MemoryData::default_instance()) + } + pub fn clear_kernel_usage(&mut self) { + self.kernel_usage.clear(); + } + + pub fn has_kernel_usage(&self) -> bool { + self.kernel_usage.is_some() + } + + // Param is passed by value, moved + pub fn set_kernel_usage(&mut self, v: MemoryData) { + self.kernel_usage = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_kernel_usage(&mut self) -> &mut MemoryData { + if self.kernel_usage.is_none() { + self.kernel_usage.set_default(); + } + self.kernel_usage.as_mut().unwrap() + } + + // Take field + pub fn take_kernel_usage(&mut self) -> MemoryData { + self.kernel_usage.take().unwrap_or_else(|| MemoryData::new()) + } + + // bool use_hierarchy = 5; + + + pub fn get_use_hierarchy(&self) -> bool { + self.use_hierarchy + } + pub fn clear_use_hierarchy(&mut self) { + self.use_hierarchy = false; + } + + // Param is passed by value, moved + pub fn set_use_hierarchy(&mut self, v: bool) { + self.use_hierarchy = v; + } + + // repeated .grpc.MemoryStats.StatsEntry stats = 6; + + + pub fn get_stats(&self) -> &::std::collections::HashMap<::std::string::String, u64> { + &self.stats + } + pub fn clear_stats(&mut self) { + self.stats.clear(); + } + + // Param is passed by value, moved + pub fn set_stats(&mut self, v: ::std::collections::HashMap<::std::string::String, u64>) { + self.stats = v; + } + + // Mutable pointer to the field. + pub fn mut_stats(&mut self) -> &mut ::std::collections::HashMap<::std::string::String, u64> { + &mut self.stats + } + + // Take field + pub fn take_stats(&mut self) -> ::std::collections::HashMap<::std::string::String, u64> { + ::std::mem::replace(&mut self.stats, ::std::collections::HashMap::new()) + } +} + +impl ::protobuf::Message for MemoryStats { + fn is_initialized(&self) -> bool { + for v in &self.usage { + if !v.is_initialized() { + return false; + } + }; + for v in &self.swap_usage { + if !v.is_initialized() { + return false; + } + }; + for v in &self.kernel_usage { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint64()?; + self.cache = tmp; + }, + 2 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.usage)?; + }, + 3 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.swap_usage)?; + }, + 4 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.kernel_usage)?; + }, + 5 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_bool()?; + self.use_hierarchy = tmp; + }, + 6 => { + ::protobuf::rt::read_map_into::<::protobuf::types::ProtobufTypeString, ::protobuf::types::ProtobufTypeUint64>(wire_type, is, &mut self.stats)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if self.cache != 0 { + my_size += ::protobuf::rt::value_size(1, self.cache, ::protobuf::wire_format::WireTypeVarint); + } + if let Some(ref v) = self.usage.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + if let Some(ref v) = self.swap_usage.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + if let Some(ref v) = self.kernel_usage.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + if self.use_hierarchy != false { + my_size += 2; + } + my_size += ::protobuf::rt::compute_map_size::<::protobuf::types::ProtobufTypeString, ::protobuf::types::ProtobufTypeUint64>(6, &self.stats); + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if self.cache != 0 { + os.write_uint64(1, self.cache)?; + } + if let Some(ref v) = self.usage.as_ref() { + os.write_tag(2, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + if let Some(ref v) = self.swap_usage.as_ref() { + os.write_tag(3, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + if let Some(ref v) = self.kernel_usage.as_ref() { + os.write_tag(4, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + if self.use_hierarchy != false { + os.write_bool(5, self.use_hierarchy)?; + } + ::protobuf::rt::write_map_with_cached_sizes::<::protobuf::types::ProtobufTypeString, ::protobuf::types::ProtobufTypeUint64>(6, &self.stats, os)?; + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> MemoryStats { + MemoryStats::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( + "cache", + |m: &MemoryStats| { &m.cache }, + |m: &mut MemoryStats| { &mut m.cache }, + )); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "usage", + |m: &MemoryStats| { &m.usage }, + |m: &mut MemoryStats| { &mut m.usage }, + )); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "swap_usage", + |m: &MemoryStats| { &m.swap_usage }, + |m: &mut MemoryStats| { &mut m.swap_usage }, + )); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "kernel_usage", + |m: &MemoryStats| { &m.kernel_usage }, + |m: &mut MemoryStats| { &mut m.kernel_usage }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeBool>( + "use_hierarchy", + |m: &MemoryStats| { &m.use_hierarchy }, + |m: &mut MemoryStats| { &mut m.use_hierarchy }, + )); + fields.push(::protobuf::reflect::accessor::make_map_accessor::<_, ::protobuf::types::ProtobufTypeString, ::protobuf::types::ProtobufTypeUint64>( + "stats", + |m: &MemoryStats| { &m.stats }, + |m: &mut MemoryStats| { &mut m.stats }, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "MemoryStats", + fields, + file_descriptor_proto() + ) + }) + } + } + + fn default_instance() -> &'static MemoryStats { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const MemoryStats, + }; + unsafe { + instance.get(MemoryStats::new) + } + } +} + +impl ::protobuf::Clear for MemoryStats { + fn clear(&mut self) { + self.cache = 0; + self.usage.clear(); + self.swap_usage.clear(); + self.kernel_usage.clear(); + self.use_hierarchy = false; + self.stats.clear(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for MemoryStats { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for MemoryStats { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct BlkioStatsEntry { + // message fields + pub major: u64, + pub minor: u64, + pub op: ::std::string::String, + pub value: u64, + // special fields + pub unknown_fields: ::protobuf::UnknownFields, + pub cached_size: ::protobuf::CachedSize, +} + +impl<'a> ::std::default::Default for &'a BlkioStatsEntry { + fn default() -> &'a BlkioStatsEntry { + ::default_instance() + } +} + +impl BlkioStatsEntry { + pub fn new() -> BlkioStatsEntry { + ::std::default::Default::default() + } + + // uint64 major = 1; + + + pub fn get_major(&self) -> u64 { + self.major + } + pub fn clear_major(&mut self) { + self.major = 0; + } + + // Param is passed by value, moved + pub fn set_major(&mut self, v: u64) { + self.major = v; + } + + // uint64 minor = 2; + + + pub fn get_minor(&self) -> u64 { + self.minor + } + pub fn clear_minor(&mut self) { + self.minor = 0; + } + + // Param is passed by value, moved + pub fn set_minor(&mut self, v: u64) { + self.minor = v; + } + + // string op = 3; + + + pub fn get_op(&self) -> &str { + &self.op + } + pub fn clear_op(&mut self) { + self.op.clear(); + } + + // Param is passed by value, moved + pub fn set_op(&mut self, v: ::std::string::String) { + self.op = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_op(&mut self) -> &mut ::std::string::String { + &mut self.op + } + + // Take field + pub fn take_op(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.op, ::std::string::String::new()) + } + + // uint64 value = 4; + + + pub fn get_value(&self) -> u64 { + self.value + } + pub fn clear_value(&mut self) { + self.value = 0; + } + + // Param is passed by value, moved + pub fn set_value(&mut self, v: u64) { + self.value = v; + } +} + +impl ::protobuf::Message for BlkioStatsEntry { + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint64()?; + self.major = tmp; + }, + 2 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint64()?; + self.minor = tmp; + }, + 3 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.op)?; + }, + 4 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint64()?; + self.value = tmp; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if self.major != 0 { + my_size += ::protobuf::rt::value_size(1, self.major, ::protobuf::wire_format::WireTypeVarint); + } + if self.minor != 0 { + my_size += ::protobuf::rt::value_size(2, self.minor, ::protobuf::wire_format::WireTypeVarint); + } + if !self.op.is_empty() { + my_size += ::protobuf::rt::string_size(3, &self.op); + } + if self.value != 0 { + my_size += ::protobuf::rt::value_size(4, self.value, ::protobuf::wire_format::WireTypeVarint); + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if self.major != 0 { + os.write_uint64(1, self.major)?; + } + if self.minor != 0 { + os.write_uint64(2, self.minor)?; + } + if !self.op.is_empty() { + os.write_string(3, &self.op)?; + } + if self.value != 0 { + os.write_uint64(4, self.value)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> BlkioStatsEntry { + BlkioStatsEntry::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( + "major", + |m: &BlkioStatsEntry| { &m.major }, + |m: &mut BlkioStatsEntry| { &mut m.major }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( + "minor", + |m: &BlkioStatsEntry| { &m.minor }, + |m: &mut BlkioStatsEntry| { &mut m.minor }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "op", + |m: &BlkioStatsEntry| { &m.op }, + |m: &mut BlkioStatsEntry| { &mut m.op }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( + "value", + |m: &BlkioStatsEntry| { &m.value }, + |m: &mut BlkioStatsEntry| { &mut m.value }, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "BlkioStatsEntry", + fields, + file_descriptor_proto() + ) + }) + } + } + + fn default_instance() -> &'static BlkioStatsEntry { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const BlkioStatsEntry, + }; + unsafe { + instance.get(BlkioStatsEntry::new) + } + } +} + +impl ::protobuf::Clear for BlkioStatsEntry { + fn clear(&mut self) { + self.major = 0; + self.minor = 0; + self.op.clear(); + self.value = 0; + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for BlkioStatsEntry { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for BlkioStatsEntry { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct BlkioStats { + // message fields + pub io_service_bytes_recursive: ::protobuf::RepeatedField, + pub io_serviced_recursive: ::protobuf::RepeatedField, + pub io_queued_recursive: ::protobuf::RepeatedField, + pub io_service_time_recursive: ::protobuf::RepeatedField, + pub io_wait_time_recursive: ::protobuf::RepeatedField, + pub io_merged_recursive: ::protobuf::RepeatedField, + pub io_time_recursive: ::protobuf::RepeatedField, + pub sectors_recursive: ::protobuf::RepeatedField, + // special fields + pub unknown_fields: ::protobuf::UnknownFields, + pub cached_size: ::protobuf::CachedSize, +} + +impl<'a> ::std::default::Default for &'a BlkioStats { + fn default() -> &'a BlkioStats { + ::default_instance() + } +} + +impl BlkioStats { + pub fn new() -> BlkioStats { + ::std::default::Default::default() + } + + // repeated .grpc.BlkioStatsEntry io_service_bytes_recursive = 1; + + + pub fn get_io_service_bytes_recursive(&self) -> &[BlkioStatsEntry] { + &self.io_service_bytes_recursive + } + pub fn clear_io_service_bytes_recursive(&mut self) { + self.io_service_bytes_recursive.clear(); + } + + // Param is passed by value, moved + pub fn set_io_service_bytes_recursive(&mut self, v: ::protobuf::RepeatedField) { + self.io_service_bytes_recursive = v; + } + + // Mutable pointer to the field. + pub fn mut_io_service_bytes_recursive(&mut self) -> &mut ::protobuf::RepeatedField { + &mut self.io_service_bytes_recursive + } + + // Take field + pub fn take_io_service_bytes_recursive(&mut self) -> ::protobuf::RepeatedField { + ::std::mem::replace(&mut self.io_service_bytes_recursive, ::protobuf::RepeatedField::new()) + } + + // repeated .grpc.BlkioStatsEntry io_serviced_recursive = 2; + + + pub fn get_io_serviced_recursive(&self) -> &[BlkioStatsEntry] { + &self.io_serviced_recursive + } + pub fn clear_io_serviced_recursive(&mut self) { + self.io_serviced_recursive.clear(); + } + + // Param is passed by value, moved + pub fn set_io_serviced_recursive(&mut self, v: ::protobuf::RepeatedField) { + self.io_serviced_recursive = v; + } + + // Mutable pointer to the field. + pub fn mut_io_serviced_recursive(&mut self) -> &mut ::protobuf::RepeatedField { + &mut self.io_serviced_recursive + } + + // Take field + pub fn take_io_serviced_recursive(&mut self) -> ::protobuf::RepeatedField { + ::std::mem::replace(&mut self.io_serviced_recursive, ::protobuf::RepeatedField::new()) + } + + // repeated .grpc.BlkioStatsEntry io_queued_recursive = 3; + + + pub fn get_io_queued_recursive(&self) -> &[BlkioStatsEntry] { + &self.io_queued_recursive + } + pub fn clear_io_queued_recursive(&mut self) { + self.io_queued_recursive.clear(); + } + + // Param is passed by value, moved + pub fn set_io_queued_recursive(&mut self, v: ::protobuf::RepeatedField) { + self.io_queued_recursive = v; + } + + // Mutable pointer to the field. + pub fn mut_io_queued_recursive(&mut self) -> &mut ::protobuf::RepeatedField { + &mut self.io_queued_recursive + } + + // Take field + pub fn take_io_queued_recursive(&mut self) -> ::protobuf::RepeatedField { + ::std::mem::replace(&mut self.io_queued_recursive, ::protobuf::RepeatedField::new()) + } + + // repeated .grpc.BlkioStatsEntry io_service_time_recursive = 4; + + + pub fn get_io_service_time_recursive(&self) -> &[BlkioStatsEntry] { + &self.io_service_time_recursive + } + pub fn clear_io_service_time_recursive(&mut self) { + self.io_service_time_recursive.clear(); + } + + // Param is passed by value, moved + pub fn set_io_service_time_recursive(&mut self, v: ::protobuf::RepeatedField) { + self.io_service_time_recursive = v; + } + + // Mutable pointer to the field. + pub fn mut_io_service_time_recursive(&mut self) -> &mut ::protobuf::RepeatedField { + &mut self.io_service_time_recursive + } + + // Take field + pub fn take_io_service_time_recursive(&mut self) -> ::protobuf::RepeatedField { + ::std::mem::replace(&mut self.io_service_time_recursive, ::protobuf::RepeatedField::new()) + } + + // repeated .grpc.BlkioStatsEntry io_wait_time_recursive = 5; + + + pub fn get_io_wait_time_recursive(&self) -> &[BlkioStatsEntry] { + &self.io_wait_time_recursive + } + pub fn clear_io_wait_time_recursive(&mut self) { + self.io_wait_time_recursive.clear(); + } + + // Param is passed by value, moved + pub fn set_io_wait_time_recursive(&mut self, v: ::protobuf::RepeatedField) { + self.io_wait_time_recursive = v; + } + + // Mutable pointer to the field. + pub fn mut_io_wait_time_recursive(&mut self) -> &mut ::protobuf::RepeatedField { + &mut self.io_wait_time_recursive + } + + // Take field + pub fn take_io_wait_time_recursive(&mut self) -> ::protobuf::RepeatedField { + ::std::mem::replace(&mut self.io_wait_time_recursive, ::protobuf::RepeatedField::new()) + } + + // repeated .grpc.BlkioStatsEntry io_merged_recursive = 6; + + + pub fn get_io_merged_recursive(&self) -> &[BlkioStatsEntry] { + &self.io_merged_recursive + } + pub fn clear_io_merged_recursive(&mut self) { + self.io_merged_recursive.clear(); + } + + // Param is passed by value, moved + pub fn set_io_merged_recursive(&mut self, v: ::protobuf::RepeatedField) { + self.io_merged_recursive = v; + } + + // Mutable pointer to the field. + pub fn mut_io_merged_recursive(&mut self) -> &mut ::protobuf::RepeatedField { + &mut self.io_merged_recursive + } + + // Take field + pub fn take_io_merged_recursive(&mut self) -> ::protobuf::RepeatedField { + ::std::mem::replace(&mut self.io_merged_recursive, ::protobuf::RepeatedField::new()) + } + + // repeated .grpc.BlkioStatsEntry io_time_recursive = 7; + + + pub fn get_io_time_recursive(&self) -> &[BlkioStatsEntry] { + &self.io_time_recursive + } + pub fn clear_io_time_recursive(&mut self) { + self.io_time_recursive.clear(); + } + + // Param is passed by value, moved + pub fn set_io_time_recursive(&mut self, v: ::protobuf::RepeatedField) { + self.io_time_recursive = v; + } + + // Mutable pointer to the field. + pub fn mut_io_time_recursive(&mut self) -> &mut ::protobuf::RepeatedField { + &mut self.io_time_recursive + } + + // Take field + pub fn take_io_time_recursive(&mut self) -> ::protobuf::RepeatedField { + ::std::mem::replace(&mut self.io_time_recursive, ::protobuf::RepeatedField::new()) + } + + // repeated .grpc.BlkioStatsEntry sectors_recursive = 8; + + + pub fn get_sectors_recursive(&self) -> &[BlkioStatsEntry] { + &self.sectors_recursive + } + pub fn clear_sectors_recursive(&mut self) { + self.sectors_recursive.clear(); + } + + // Param is passed by value, moved + pub fn set_sectors_recursive(&mut self, v: ::protobuf::RepeatedField) { + self.sectors_recursive = v; + } + + // Mutable pointer to the field. + pub fn mut_sectors_recursive(&mut self) -> &mut ::protobuf::RepeatedField { + &mut self.sectors_recursive + } + + // Take field + pub fn take_sectors_recursive(&mut self) -> ::protobuf::RepeatedField { + ::std::mem::replace(&mut self.sectors_recursive, ::protobuf::RepeatedField::new()) + } +} + +impl ::protobuf::Message for BlkioStats { + fn is_initialized(&self) -> bool { + for v in &self.io_service_bytes_recursive { + if !v.is_initialized() { + return false; + } + }; + for v in &self.io_serviced_recursive { + if !v.is_initialized() { + return false; + } + }; + for v in &self.io_queued_recursive { + if !v.is_initialized() { + return false; + } + }; + for v in &self.io_service_time_recursive { + if !v.is_initialized() { + return false; + } + }; + for v in &self.io_wait_time_recursive { + if !v.is_initialized() { + return false; + } + }; + for v in &self.io_merged_recursive { + if !v.is_initialized() { + return false; + } + }; + for v in &self.io_time_recursive { + if !v.is_initialized() { + return false; + } + }; + for v in &self.sectors_recursive { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_repeated_message_into(wire_type, is, &mut self.io_service_bytes_recursive)?; + }, + 2 => { + ::protobuf::rt::read_repeated_message_into(wire_type, is, &mut self.io_serviced_recursive)?; + }, + 3 => { + ::protobuf::rt::read_repeated_message_into(wire_type, is, &mut self.io_queued_recursive)?; + }, + 4 => { + ::protobuf::rt::read_repeated_message_into(wire_type, is, &mut self.io_service_time_recursive)?; + }, + 5 => { + ::protobuf::rt::read_repeated_message_into(wire_type, is, &mut self.io_wait_time_recursive)?; + }, + 6 => { + ::protobuf::rt::read_repeated_message_into(wire_type, is, &mut self.io_merged_recursive)?; + }, + 7 => { + ::protobuf::rt::read_repeated_message_into(wire_type, is, &mut self.io_time_recursive)?; + }, + 8 => { + ::protobuf::rt::read_repeated_message_into(wire_type, is, &mut self.sectors_recursive)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + for value in &self.io_service_bytes_recursive { + let len = value.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + }; + for value in &self.io_serviced_recursive { + let len = value.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + }; + for value in &self.io_queued_recursive { + let len = value.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + }; + for value in &self.io_service_time_recursive { + let len = value.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + }; + for value in &self.io_wait_time_recursive { + let len = value.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + }; + for value in &self.io_merged_recursive { + let len = value.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + }; + for value in &self.io_time_recursive { + let len = value.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + }; + for value in &self.sectors_recursive { + let len = value.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + }; + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + for v in &self.io_service_bytes_recursive { + os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + }; + for v in &self.io_serviced_recursive { + os.write_tag(2, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + }; + for v in &self.io_queued_recursive { + os.write_tag(3, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + }; + for v in &self.io_service_time_recursive { + os.write_tag(4, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + }; + for v in &self.io_wait_time_recursive { + os.write_tag(5, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + }; + for v in &self.io_merged_recursive { + os.write_tag(6, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + }; + for v in &self.io_time_recursive { + os.write_tag(7, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + }; + for v in &self.sectors_recursive { + os.write_tag(8, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + }; + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> BlkioStats { + BlkioStats::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "io_service_bytes_recursive", + |m: &BlkioStats| { &m.io_service_bytes_recursive }, + |m: &mut BlkioStats| { &mut m.io_service_bytes_recursive }, + )); + fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "io_serviced_recursive", + |m: &BlkioStats| { &m.io_serviced_recursive }, + |m: &mut BlkioStats| { &mut m.io_serviced_recursive }, + )); + fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "io_queued_recursive", + |m: &BlkioStats| { &m.io_queued_recursive }, + |m: &mut BlkioStats| { &mut m.io_queued_recursive }, + )); + fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "io_service_time_recursive", + |m: &BlkioStats| { &m.io_service_time_recursive }, + |m: &mut BlkioStats| { &mut m.io_service_time_recursive }, + )); + fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "io_wait_time_recursive", + |m: &BlkioStats| { &m.io_wait_time_recursive }, + |m: &mut BlkioStats| { &mut m.io_wait_time_recursive }, + )); + fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "io_merged_recursive", + |m: &BlkioStats| { &m.io_merged_recursive }, + |m: &mut BlkioStats| { &mut m.io_merged_recursive }, + )); + fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "io_time_recursive", + |m: &BlkioStats| { &m.io_time_recursive }, + |m: &mut BlkioStats| { &mut m.io_time_recursive }, + )); + fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "sectors_recursive", + |m: &BlkioStats| { &m.sectors_recursive }, + |m: &mut BlkioStats| { &mut m.sectors_recursive }, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "BlkioStats", + fields, + file_descriptor_proto() + ) + }) + } + } + + fn default_instance() -> &'static BlkioStats { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const BlkioStats, + }; + unsafe { + instance.get(BlkioStats::new) + } + } +} + +impl ::protobuf::Clear for BlkioStats { + fn clear(&mut self) { + self.io_service_bytes_recursive.clear(); + self.io_serviced_recursive.clear(); + self.io_queued_recursive.clear(); + self.io_service_time_recursive.clear(); + self.io_wait_time_recursive.clear(); + self.io_merged_recursive.clear(); + self.io_time_recursive.clear(); + self.sectors_recursive.clear(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for BlkioStats { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for BlkioStats { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct HugetlbStats { + // message fields + pub usage: u64, + pub max_usage: u64, + pub failcnt: u64, + // special fields + pub unknown_fields: ::protobuf::UnknownFields, + pub cached_size: ::protobuf::CachedSize, +} + +impl<'a> ::std::default::Default for &'a HugetlbStats { + fn default() -> &'a HugetlbStats { + ::default_instance() + } +} + +impl HugetlbStats { + pub fn new() -> HugetlbStats { + ::std::default::Default::default() + } + + // uint64 usage = 1; + + + pub fn get_usage(&self) -> u64 { + self.usage + } + pub fn clear_usage(&mut self) { + self.usage = 0; + } + + // Param is passed by value, moved + pub fn set_usage(&mut self, v: u64) { + self.usage = v; + } + + // uint64 max_usage = 2; + + + pub fn get_max_usage(&self) -> u64 { + self.max_usage + } + pub fn clear_max_usage(&mut self) { + self.max_usage = 0; + } + + // Param is passed by value, moved + pub fn set_max_usage(&mut self, v: u64) { + self.max_usage = v; + } + + // uint64 failcnt = 3; + + + pub fn get_failcnt(&self) -> u64 { + self.failcnt + } + pub fn clear_failcnt(&mut self) { + self.failcnt = 0; + } + + // Param is passed by value, moved + pub fn set_failcnt(&mut self, v: u64) { + self.failcnt = v; + } +} + +impl ::protobuf::Message for HugetlbStats { + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint64()?; + self.usage = tmp; + }, + 2 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint64()?; + self.max_usage = tmp; + }, + 3 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint64()?; + self.failcnt = tmp; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if self.usage != 0 { + my_size += ::protobuf::rt::value_size(1, self.usage, ::protobuf::wire_format::WireTypeVarint); + } + if self.max_usage != 0 { + my_size += ::protobuf::rt::value_size(2, self.max_usage, ::protobuf::wire_format::WireTypeVarint); + } + if self.failcnt != 0 { + my_size += ::protobuf::rt::value_size(3, self.failcnt, ::protobuf::wire_format::WireTypeVarint); + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if self.usage != 0 { + os.write_uint64(1, self.usage)?; + } + if self.max_usage != 0 { + os.write_uint64(2, self.max_usage)?; + } + if self.failcnt != 0 { + os.write_uint64(3, self.failcnt)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> HugetlbStats { + HugetlbStats::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( + "usage", + |m: &HugetlbStats| { &m.usage }, + |m: &mut HugetlbStats| { &mut m.usage }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( + "max_usage", + |m: &HugetlbStats| { &m.max_usage }, + |m: &mut HugetlbStats| { &mut m.max_usage }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( + "failcnt", + |m: &HugetlbStats| { &m.failcnt }, + |m: &mut HugetlbStats| { &mut m.failcnt }, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "HugetlbStats", + fields, + file_descriptor_proto() + ) + }) + } + } + + fn default_instance() -> &'static HugetlbStats { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const HugetlbStats, + }; + unsafe { + instance.get(HugetlbStats::new) + } + } +} + +impl ::protobuf::Clear for HugetlbStats { + fn clear(&mut self) { + self.usage = 0; + self.max_usage = 0; + self.failcnt = 0; + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for HugetlbStats { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for HugetlbStats { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct CgroupStats { + // message fields + pub cpu_stats: ::protobuf::SingularPtrField, + pub memory_stats: ::protobuf::SingularPtrField, + pub pids_stats: ::protobuf::SingularPtrField, + pub blkio_stats: ::protobuf::SingularPtrField, + pub hugetlb_stats: ::std::collections::HashMap<::std::string::String, HugetlbStats>, + // special fields + pub unknown_fields: ::protobuf::UnknownFields, + pub cached_size: ::protobuf::CachedSize, +} + +impl<'a> ::std::default::Default for &'a CgroupStats { + fn default() -> &'a CgroupStats { + ::default_instance() + } +} + +impl CgroupStats { + pub fn new() -> CgroupStats { + ::std::default::Default::default() + } + + // .grpc.CpuStats cpu_stats = 1; + + + pub fn get_cpu_stats(&self) -> &CpuStats { + self.cpu_stats.as_ref().unwrap_or_else(|| CpuStats::default_instance()) + } + pub fn clear_cpu_stats(&mut self) { + self.cpu_stats.clear(); + } + + pub fn has_cpu_stats(&self) -> bool { + self.cpu_stats.is_some() + } + + // Param is passed by value, moved + pub fn set_cpu_stats(&mut self, v: CpuStats) { + self.cpu_stats = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_cpu_stats(&mut self) -> &mut CpuStats { + if self.cpu_stats.is_none() { + self.cpu_stats.set_default(); + } + self.cpu_stats.as_mut().unwrap() + } + + // Take field + pub fn take_cpu_stats(&mut self) -> CpuStats { + self.cpu_stats.take().unwrap_or_else(|| CpuStats::new()) + } + + // .grpc.MemoryStats memory_stats = 2; + + + pub fn get_memory_stats(&self) -> &MemoryStats { + self.memory_stats.as_ref().unwrap_or_else(|| MemoryStats::default_instance()) + } + pub fn clear_memory_stats(&mut self) { + self.memory_stats.clear(); + } + + pub fn has_memory_stats(&self) -> bool { + self.memory_stats.is_some() + } + + // Param is passed by value, moved + pub fn set_memory_stats(&mut self, v: MemoryStats) { + self.memory_stats = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_memory_stats(&mut self) -> &mut MemoryStats { + if self.memory_stats.is_none() { + self.memory_stats.set_default(); + } + self.memory_stats.as_mut().unwrap() + } + + // Take field + pub fn take_memory_stats(&mut self) -> MemoryStats { + self.memory_stats.take().unwrap_or_else(|| MemoryStats::new()) + } + + // .grpc.PidsStats pids_stats = 3; + + + pub fn get_pids_stats(&self) -> &PidsStats { + self.pids_stats.as_ref().unwrap_or_else(|| PidsStats::default_instance()) + } + pub fn clear_pids_stats(&mut self) { + self.pids_stats.clear(); + } + + pub fn has_pids_stats(&self) -> bool { + self.pids_stats.is_some() + } + + // Param is passed by value, moved + pub fn set_pids_stats(&mut self, v: PidsStats) { + self.pids_stats = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_pids_stats(&mut self) -> &mut PidsStats { + if self.pids_stats.is_none() { + self.pids_stats.set_default(); + } + self.pids_stats.as_mut().unwrap() + } + + // Take field + pub fn take_pids_stats(&mut self) -> PidsStats { + self.pids_stats.take().unwrap_or_else(|| PidsStats::new()) + } + + // .grpc.BlkioStats blkio_stats = 4; + + + pub fn get_blkio_stats(&self) -> &BlkioStats { + self.blkio_stats.as_ref().unwrap_or_else(|| BlkioStats::default_instance()) + } + pub fn clear_blkio_stats(&mut self) { + self.blkio_stats.clear(); + } + + pub fn has_blkio_stats(&self) -> bool { + self.blkio_stats.is_some() + } + + // Param is passed by value, moved + pub fn set_blkio_stats(&mut self, v: BlkioStats) { + self.blkio_stats = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_blkio_stats(&mut self) -> &mut BlkioStats { + if self.blkio_stats.is_none() { + self.blkio_stats.set_default(); + } + self.blkio_stats.as_mut().unwrap() + } + + // Take field + pub fn take_blkio_stats(&mut self) -> BlkioStats { + self.blkio_stats.take().unwrap_or_else(|| BlkioStats::new()) + } + + // repeated .grpc.CgroupStats.HugetlbStatsEntry hugetlb_stats = 5; + + + pub fn get_hugetlb_stats(&self) -> &::std::collections::HashMap<::std::string::String, HugetlbStats> { + &self.hugetlb_stats + } + pub fn clear_hugetlb_stats(&mut self) { + self.hugetlb_stats.clear(); + } + + // Param is passed by value, moved + pub fn set_hugetlb_stats(&mut self, v: ::std::collections::HashMap<::std::string::String, HugetlbStats>) { + self.hugetlb_stats = v; + } + + // Mutable pointer to the field. + pub fn mut_hugetlb_stats(&mut self) -> &mut ::std::collections::HashMap<::std::string::String, HugetlbStats> { + &mut self.hugetlb_stats + } + + // Take field + pub fn take_hugetlb_stats(&mut self) -> ::std::collections::HashMap<::std::string::String, HugetlbStats> { + ::std::mem::replace(&mut self.hugetlb_stats, ::std::collections::HashMap::new()) + } +} + +impl ::protobuf::Message for CgroupStats { + fn is_initialized(&self) -> bool { + for v in &self.cpu_stats { + if !v.is_initialized() { + return false; + } + }; + for v in &self.memory_stats { + if !v.is_initialized() { + return false; + } + }; + for v in &self.pids_stats { + if !v.is_initialized() { + return false; + } + }; + for v in &self.blkio_stats { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.cpu_stats)?; + }, + 2 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.memory_stats)?; + }, + 3 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.pids_stats)?; + }, + 4 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.blkio_stats)?; + }, + 5 => { + ::protobuf::rt::read_map_into::<::protobuf::types::ProtobufTypeString, ::protobuf::types::ProtobufTypeMessage>(wire_type, is, &mut self.hugetlb_stats)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if let Some(ref v) = self.cpu_stats.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + if let Some(ref v) = self.memory_stats.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + if let Some(ref v) = self.pids_stats.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + if let Some(ref v) = self.blkio_stats.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + my_size += ::protobuf::rt::compute_map_size::<::protobuf::types::ProtobufTypeString, ::protobuf::types::ProtobufTypeMessage>(5, &self.hugetlb_stats); + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if let Some(ref v) = self.cpu_stats.as_ref() { + os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + if let Some(ref v) = self.memory_stats.as_ref() { + os.write_tag(2, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + if let Some(ref v) = self.pids_stats.as_ref() { + os.write_tag(3, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + if let Some(ref v) = self.blkio_stats.as_ref() { + os.write_tag(4, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + ::protobuf::rt::write_map_with_cached_sizes::<::protobuf::types::ProtobufTypeString, ::protobuf::types::ProtobufTypeMessage>(5, &self.hugetlb_stats, os)?; + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> CgroupStats { + CgroupStats::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "cpu_stats", + |m: &CgroupStats| { &m.cpu_stats }, + |m: &mut CgroupStats| { &mut m.cpu_stats }, + )); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "memory_stats", + |m: &CgroupStats| { &m.memory_stats }, + |m: &mut CgroupStats| { &mut m.memory_stats }, + )); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "pids_stats", + |m: &CgroupStats| { &m.pids_stats }, + |m: &mut CgroupStats| { &mut m.pids_stats }, + )); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "blkio_stats", + |m: &CgroupStats| { &m.blkio_stats }, + |m: &mut CgroupStats| { &mut m.blkio_stats }, + )); + fields.push(::protobuf::reflect::accessor::make_map_accessor::<_, ::protobuf::types::ProtobufTypeString, ::protobuf::types::ProtobufTypeMessage>( + "hugetlb_stats", + |m: &CgroupStats| { &m.hugetlb_stats }, + |m: &mut CgroupStats| { &mut m.hugetlb_stats }, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "CgroupStats", + fields, + file_descriptor_proto() + ) + }) + } + } + + fn default_instance() -> &'static CgroupStats { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const CgroupStats, + }; + unsafe { + instance.get(CgroupStats::new) + } + } +} + +impl ::protobuf::Clear for CgroupStats { + fn clear(&mut self) { + self.cpu_stats.clear(); + self.memory_stats.clear(); + self.pids_stats.clear(); + self.blkio_stats.clear(); + self.hugetlb_stats.clear(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for CgroupStats { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for CgroupStats { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct NetworkStats { + // message fields + pub name: ::std::string::String, + pub rx_bytes: u64, + pub rx_packets: u64, + pub rx_errors: u64, + pub rx_dropped: u64, + pub tx_bytes: u64, + pub tx_packets: u64, + pub tx_errors: u64, + pub tx_dropped: u64, + // special fields + pub unknown_fields: ::protobuf::UnknownFields, + pub cached_size: ::protobuf::CachedSize, +} + +impl<'a> ::std::default::Default for &'a NetworkStats { + fn default() -> &'a NetworkStats { + ::default_instance() + } +} + +impl NetworkStats { + pub fn new() -> NetworkStats { + ::std::default::Default::default() + } + + // string name = 1; + + + pub fn get_name(&self) -> &str { + &self.name + } + pub fn clear_name(&mut self) { + self.name.clear(); + } + + // Param is passed by value, moved + pub fn set_name(&mut self, v: ::std::string::String) { + self.name = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_name(&mut self) -> &mut ::std::string::String { + &mut self.name + } + + // Take field + pub fn take_name(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.name, ::std::string::String::new()) + } + + // uint64 rx_bytes = 2; + + + pub fn get_rx_bytes(&self) -> u64 { + self.rx_bytes + } + pub fn clear_rx_bytes(&mut self) { + self.rx_bytes = 0; + } + + // Param is passed by value, moved + pub fn set_rx_bytes(&mut self, v: u64) { + self.rx_bytes = v; + } + + // uint64 rx_packets = 3; + + + pub fn get_rx_packets(&self) -> u64 { + self.rx_packets + } + pub fn clear_rx_packets(&mut self) { + self.rx_packets = 0; + } + + // Param is passed by value, moved + pub fn set_rx_packets(&mut self, v: u64) { + self.rx_packets = v; + } + + // uint64 rx_errors = 4; + + + pub fn get_rx_errors(&self) -> u64 { + self.rx_errors + } + pub fn clear_rx_errors(&mut self) { + self.rx_errors = 0; + } + + // Param is passed by value, moved + pub fn set_rx_errors(&mut self, v: u64) { + self.rx_errors = v; + } + + // uint64 rx_dropped = 5; + + + pub fn get_rx_dropped(&self) -> u64 { + self.rx_dropped + } + pub fn clear_rx_dropped(&mut self) { + self.rx_dropped = 0; + } + + // Param is passed by value, moved + pub fn set_rx_dropped(&mut self, v: u64) { + self.rx_dropped = v; + } + + // uint64 tx_bytes = 6; + + + pub fn get_tx_bytes(&self) -> u64 { + self.tx_bytes + } + pub fn clear_tx_bytes(&mut self) { + self.tx_bytes = 0; + } + + // Param is passed by value, moved + pub fn set_tx_bytes(&mut self, v: u64) { + self.tx_bytes = v; + } + + // uint64 tx_packets = 7; + + + pub fn get_tx_packets(&self) -> u64 { + self.tx_packets + } + pub fn clear_tx_packets(&mut self) { + self.tx_packets = 0; + } + + // Param is passed by value, moved + pub fn set_tx_packets(&mut self, v: u64) { + self.tx_packets = v; + } + + // uint64 tx_errors = 8; + + + pub fn get_tx_errors(&self) -> u64 { + self.tx_errors + } + pub fn clear_tx_errors(&mut self) { + self.tx_errors = 0; + } + + // Param is passed by value, moved + pub fn set_tx_errors(&mut self, v: u64) { + self.tx_errors = v; + } + + // uint64 tx_dropped = 9; + + + pub fn get_tx_dropped(&self) -> u64 { + self.tx_dropped + } + pub fn clear_tx_dropped(&mut self) { + self.tx_dropped = 0; + } + + // Param is passed by value, moved + pub fn set_tx_dropped(&mut self, v: u64) { + self.tx_dropped = v; + } +} + +impl ::protobuf::Message for NetworkStats { + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.name)?; + }, + 2 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint64()?; + self.rx_bytes = tmp; + }, + 3 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint64()?; + self.rx_packets = tmp; + }, + 4 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint64()?; + self.rx_errors = tmp; + }, + 5 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint64()?; + self.rx_dropped = tmp; + }, + 6 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint64()?; + self.tx_bytes = tmp; + }, + 7 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint64()?; + self.tx_packets = tmp; + }, + 8 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint64()?; + self.tx_errors = tmp; + }, + 9 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint64()?; + self.tx_dropped = tmp; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if !self.name.is_empty() { + my_size += ::protobuf::rt::string_size(1, &self.name); + } + if self.rx_bytes != 0 { + my_size += ::protobuf::rt::value_size(2, self.rx_bytes, ::protobuf::wire_format::WireTypeVarint); + } + if self.rx_packets != 0 { + my_size += ::protobuf::rt::value_size(3, self.rx_packets, ::protobuf::wire_format::WireTypeVarint); + } + if self.rx_errors != 0 { + my_size += ::protobuf::rt::value_size(4, self.rx_errors, ::protobuf::wire_format::WireTypeVarint); + } + if self.rx_dropped != 0 { + my_size += ::protobuf::rt::value_size(5, self.rx_dropped, ::protobuf::wire_format::WireTypeVarint); + } + if self.tx_bytes != 0 { + my_size += ::protobuf::rt::value_size(6, self.tx_bytes, ::protobuf::wire_format::WireTypeVarint); + } + if self.tx_packets != 0 { + my_size += ::protobuf::rt::value_size(7, self.tx_packets, ::protobuf::wire_format::WireTypeVarint); + } + if self.tx_errors != 0 { + my_size += ::protobuf::rt::value_size(8, self.tx_errors, ::protobuf::wire_format::WireTypeVarint); + } + if self.tx_dropped != 0 { + my_size += ::protobuf::rt::value_size(9, self.tx_dropped, ::protobuf::wire_format::WireTypeVarint); + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if !self.name.is_empty() { + os.write_string(1, &self.name)?; + } + if self.rx_bytes != 0 { + os.write_uint64(2, self.rx_bytes)?; + } + if self.rx_packets != 0 { + os.write_uint64(3, self.rx_packets)?; + } + if self.rx_errors != 0 { + os.write_uint64(4, self.rx_errors)?; + } + if self.rx_dropped != 0 { + os.write_uint64(5, self.rx_dropped)?; + } + if self.tx_bytes != 0 { + os.write_uint64(6, self.tx_bytes)?; + } + if self.tx_packets != 0 { + os.write_uint64(7, self.tx_packets)?; + } + if self.tx_errors != 0 { + os.write_uint64(8, self.tx_errors)?; + } + if self.tx_dropped != 0 { + os.write_uint64(9, self.tx_dropped)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> NetworkStats { + NetworkStats::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "name", + |m: &NetworkStats| { &m.name }, + |m: &mut NetworkStats| { &mut m.name }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( + "rx_bytes", + |m: &NetworkStats| { &m.rx_bytes }, + |m: &mut NetworkStats| { &mut m.rx_bytes }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( + "rx_packets", + |m: &NetworkStats| { &m.rx_packets }, + |m: &mut NetworkStats| { &mut m.rx_packets }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( + "rx_errors", + |m: &NetworkStats| { &m.rx_errors }, + |m: &mut NetworkStats| { &mut m.rx_errors }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( + "rx_dropped", + |m: &NetworkStats| { &m.rx_dropped }, + |m: &mut NetworkStats| { &mut m.rx_dropped }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( + "tx_bytes", + |m: &NetworkStats| { &m.tx_bytes }, + |m: &mut NetworkStats| { &mut m.tx_bytes }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( + "tx_packets", + |m: &NetworkStats| { &m.tx_packets }, + |m: &mut NetworkStats| { &mut m.tx_packets }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( + "tx_errors", + |m: &NetworkStats| { &m.tx_errors }, + |m: &mut NetworkStats| { &mut m.tx_errors }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( + "tx_dropped", + |m: &NetworkStats| { &m.tx_dropped }, + |m: &mut NetworkStats| { &mut m.tx_dropped }, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "NetworkStats", + fields, + file_descriptor_proto() + ) + }) + } + } + + fn default_instance() -> &'static NetworkStats { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const NetworkStats, + }; + unsafe { + instance.get(NetworkStats::new) + } + } +} + +impl ::protobuf::Clear for NetworkStats { + fn clear(&mut self) { + self.name.clear(); + self.rx_bytes = 0; + self.rx_packets = 0; + self.rx_errors = 0; + self.rx_dropped = 0; + self.tx_bytes = 0; + self.tx_packets = 0; + self.tx_errors = 0; + self.tx_dropped = 0; + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for NetworkStats { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for NetworkStats { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct StatsContainerResponse { + // message fields + pub cgroup_stats: ::protobuf::SingularPtrField, + pub network_stats: ::protobuf::RepeatedField, + // special fields + pub unknown_fields: ::protobuf::UnknownFields, + pub cached_size: ::protobuf::CachedSize, +} + +impl<'a> ::std::default::Default for &'a StatsContainerResponse { + fn default() -> &'a StatsContainerResponse { + ::default_instance() + } +} + +impl StatsContainerResponse { + pub fn new() -> StatsContainerResponse { + ::std::default::Default::default() + } + + // .grpc.CgroupStats cgroup_stats = 1; + + + pub fn get_cgroup_stats(&self) -> &CgroupStats { + self.cgroup_stats.as_ref().unwrap_or_else(|| CgroupStats::default_instance()) + } + pub fn clear_cgroup_stats(&mut self) { + self.cgroup_stats.clear(); + } + + pub fn has_cgroup_stats(&self) -> bool { + self.cgroup_stats.is_some() + } + + // Param is passed by value, moved + pub fn set_cgroup_stats(&mut self, v: CgroupStats) { + self.cgroup_stats = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_cgroup_stats(&mut self) -> &mut CgroupStats { + if self.cgroup_stats.is_none() { + self.cgroup_stats.set_default(); + } + self.cgroup_stats.as_mut().unwrap() + } + + // Take field + pub fn take_cgroup_stats(&mut self) -> CgroupStats { + self.cgroup_stats.take().unwrap_or_else(|| CgroupStats::new()) + } + + // repeated .grpc.NetworkStats network_stats = 2; + + + pub fn get_network_stats(&self) -> &[NetworkStats] { + &self.network_stats + } + pub fn clear_network_stats(&mut self) { + self.network_stats.clear(); + } + + // Param is passed by value, moved + pub fn set_network_stats(&mut self, v: ::protobuf::RepeatedField) { + self.network_stats = v; + } + + // Mutable pointer to the field. + pub fn mut_network_stats(&mut self) -> &mut ::protobuf::RepeatedField { + &mut self.network_stats + } + + // Take field + pub fn take_network_stats(&mut self) -> ::protobuf::RepeatedField { + ::std::mem::replace(&mut self.network_stats, ::protobuf::RepeatedField::new()) + } +} + +impl ::protobuf::Message for StatsContainerResponse { + fn is_initialized(&self) -> bool { + for v in &self.cgroup_stats { + if !v.is_initialized() { + return false; + } + }; + for v in &self.network_stats { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.cgroup_stats)?; + }, + 2 => { + ::protobuf::rt::read_repeated_message_into(wire_type, is, &mut self.network_stats)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if let Some(ref v) = self.cgroup_stats.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + for value in &self.network_stats { + let len = value.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + }; + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if let Some(ref v) = self.cgroup_stats.as_ref() { + os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + for v in &self.network_stats { + os.write_tag(2, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + }; + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> StatsContainerResponse { + StatsContainerResponse::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "cgroup_stats", + |m: &StatsContainerResponse| { &m.cgroup_stats }, + |m: &mut StatsContainerResponse| { &mut m.cgroup_stats }, + )); + fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "network_stats", + |m: &StatsContainerResponse| { &m.network_stats }, + |m: &mut StatsContainerResponse| { &mut m.network_stats }, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "StatsContainerResponse", + fields, + file_descriptor_proto() + ) + }) + } + } + + fn default_instance() -> &'static StatsContainerResponse { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const StatsContainerResponse, + }; + unsafe { + instance.get(StatsContainerResponse::new) + } + } +} + +impl ::protobuf::Clear for StatsContainerResponse { + fn clear(&mut self) { + self.cgroup_stats.clear(); + self.network_stats.clear(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for StatsContainerResponse { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for StatsContainerResponse { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct WriteStreamRequest { + // message fields + pub container_id: ::std::string::String, + pub exec_id: ::std::string::String, + pub data: ::std::vec::Vec, + // special fields + pub unknown_fields: ::protobuf::UnknownFields, + pub cached_size: ::protobuf::CachedSize, +} + +impl<'a> ::std::default::Default for &'a WriteStreamRequest { + fn default() -> &'a WriteStreamRequest { + ::default_instance() + } +} + +impl WriteStreamRequest { + pub fn new() -> WriteStreamRequest { + ::std::default::Default::default() + } + + // string container_id = 1; + + + pub fn get_container_id(&self) -> &str { + &self.container_id + } + pub fn clear_container_id(&mut self) { + self.container_id.clear(); + } + + // Param is passed by value, moved + pub fn set_container_id(&mut self, v: ::std::string::String) { + self.container_id = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_container_id(&mut self) -> &mut ::std::string::String { + &mut self.container_id + } + + // Take field + pub fn take_container_id(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.container_id, ::std::string::String::new()) + } + + // string exec_id = 2; + + + pub fn get_exec_id(&self) -> &str { + &self.exec_id + } + pub fn clear_exec_id(&mut self) { + self.exec_id.clear(); + } + + // Param is passed by value, moved + pub fn set_exec_id(&mut self, v: ::std::string::String) { + self.exec_id = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_exec_id(&mut self) -> &mut ::std::string::String { + &mut self.exec_id + } + + // Take field + pub fn take_exec_id(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.exec_id, ::std::string::String::new()) + } + + // bytes data = 3; + + + pub fn get_data(&self) -> &[u8] { + &self.data + } + pub fn clear_data(&mut self) { + self.data.clear(); + } + + // Param is passed by value, moved + pub fn set_data(&mut self, v: ::std::vec::Vec) { + self.data = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_data(&mut self) -> &mut ::std::vec::Vec { + &mut self.data + } + + // Take field + pub fn take_data(&mut self) -> ::std::vec::Vec { + ::std::mem::replace(&mut self.data, ::std::vec::Vec::new()) + } +} + +impl ::protobuf::Message for WriteStreamRequest { + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.container_id)?; + }, + 2 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.exec_id)?; + }, + 3 => { + ::protobuf::rt::read_singular_proto3_bytes_into(wire_type, is, &mut self.data)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if !self.container_id.is_empty() { + my_size += ::protobuf::rt::string_size(1, &self.container_id); + } + if !self.exec_id.is_empty() { + my_size += ::protobuf::rt::string_size(2, &self.exec_id); + } + if !self.data.is_empty() { + my_size += ::protobuf::rt::bytes_size(3, &self.data); + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if !self.container_id.is_empty() { + os.write_string(1, &self.container_id)?; + } + if !self.exec_id.is_empty() { + os.write_string(2, &self.exec_id)?; + } + if !self.data.is_empty() { + os.write_bytes(3, &self.data)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> WriteStreamRequest { + WriteStreamRequest::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "container_id", + |m: &WriteStreamRequest| { &m.container_id }, + |m: &mut WriteStreamRequest| { &mut m.container_id }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "exec_id", + |m: &WriteStreamRequest| { &m.exec_id }, + |m: &mut WriteStreamRequest| { &mut m.exec_id }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( + "data", + |m: &WriteStreamRequest| { &m.data }, + |m: &mut WriteStreamRequest| { &mut m.data }, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "WriteStreamRequest", + fields, + file_descriptor_proto() + ) + }) + } + } + + fn default_instance() -> &'static WriteStreamRequest { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const WriteStreamRequest, + }; + unsafe { + instance.get(WriteStreamRequest::new) + } + } +} + +impl ::protobuf::Clear for WriteStreamRequest { + fn clear(&mut self) { + self.container_id.clear(); + self.exec_id.clear(); + self.data.clear(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for WriteStreamRequest { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for WriteStreamRequest { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct WriteStreamResponse { + // message fields + pub len: u32, + // special fields + pub unknown_fields: ::protobuf::UnknownFields, + pub cached_size: ::protobuf::CachedSize, +} + +impl<'a> ::std::default::Default for &'a WriteStreamResponse { + fn default() -> &'a WriteStreamResponse { + ::default_instance() + } +} + +impl WriteStreamResponse { + pub fn new() -> WriteStreamResponse { + ::std::default::Default::default() + } + + // uint32 len = 1; + + + pub fn get_len(&self) -> u32 { + self.len + } + pub fn clear_len(&mut self) { + self.len = 0; + } + + // Param is passed by value, moved + pub fn set_len(&mut self, v: u32) { + self.len = v; + } +} + +impl ::protobuf::Message for WriteStreamResponse { + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint32()?; + self.len = tmp; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if self.len != 0 { + my_size += ::protobuf::rt::value_size(1, self.len, ::protobuf::wire_format::WireTypeVarint); + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if self.len != 0 { + os.write_uint32(1, self.len)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> WriteStreamResponse { + WriteStreamResponse::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint32>( + "len", + |m: &WriteStreamResponse| { &m.len }, + |m: &mut WriteStreamResponse| { &mut m.len }, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "WriteStreamResponse", + fields, + file_descriptor_proto() + ) + }) + } + } + + fn default_instance() -> &'static WriteStreamResponse { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const WriteStreamResponse, + }; + unsafe { + instance.get(WriteStreamResponse::new) + } + } +} + +impl ::protobuf::Clear for WriteStreamResponse { + fn clear(&mut self) { + self.len = 0; + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for WriteStreamResponse { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for WriteStreamResponse { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct ReadStreamRequest { + // message fields + pub container_id: ::std::string::String, + pub exec_id: ::std::string::String, + pub len: u32, + // special fields + pub unknown_fields: ::protobuf::UnknownFields, + pub cached_size: ::protobuf::CachedSize, +} + +impl<'a> ::std::default::Default for &'a ReadStreamRequest { + fn default() -> &'a ReadStreamRequest { + ::default_instance() + } +} + +impl ReadStreamRequest { + pub fn new() -> ReadStreamRequest { + ::std::default::Default::default() + } + + // string container_id = 1; + + + pub fn get_container_id(&self) -> &str { + &self.container_id + } + pub fn clear_container_id(&mut self) { + self.container_id.clear(); + } + + // Param is passed by value, moved + pub fn set_container_id(&mut self, v: ::std::string::String) { + self.container_id = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_container_id(&mut self) -> &mut ::std::string::String { + &mut self.container_id + } + + // Take field + pub fn take_container_id(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.container_id, ::std::string::String::new()) + } + + // string exec_id = 2; + + + pub fn get_exec_id(&self) -> &str { + &self.exec_id + } + pub fn clear_exec_id(&mut self) { + self.exec_id.clear(); + } + + // Param is passed by value, moved + pub fn set_exec_id(&mut self, v: ::std::string::String) { + self.exec_id = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_exec_id(&mut self) -> &mut ::std::string::String { + &mut self.exec_id + } + + // Take field + pub fn take_exec_id(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.exec_id, ::std::string::String::new()) + } + + // uint32 len = 3; + + + pub fn get_len(&self) -> u32 { + self.len + } + pub fn clear_len(&mut self) { + self.len = 0; + } + + // Param is passed by value, moved + pub fn set_len(&mut self, v: u32) { + self.len = v; + } +} + +impl ::protobuf::Message for ReadStreamRequest { + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.container_id)?; + }, + 2 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.exec_id)?; + }, + 3 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint32()?; + self.len = tmp; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if !self.container_id.is_empty() { + my_size += ::protobuf::rt::string_size(1, &self.container_id); + } + if !self.exec_id.is_empty() { + my_size += ::protobuf::rt::string_size(2, &self.exec_id); + } + if self.len != 0 { + my_size += ::protobuf::rt::value_size(3, self.len, ::protobuf::wire_format::WireTypeVarint); + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if !self.container_id.is_empty() { + os.write_string(1, &self.container_id)?; + } + if !self.exec_id.is_empty() { + os.write_string(2, &self.exec_id)?; + } + if self.len != 0 { + os.write_uint32(3, self.len)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> ReadStreamRequest { + ReadStreamRequest::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "container_id", + |m: &ReadStreamRequest| { &m.container_id }, + |m: &mut ReadStreamRequest| { &mut m.container_id }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "exec_id", + |m: &ReadStreamRequest| { &m.exec_id }, + |m: &mut ReadStreamRequest| { &mut m.exec_id }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint32>( + "len", + |m: &ReadStreamRequest| { &m.len }, + |m: &mut ReadStreamRequest| { &mut m.len }, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "ReadStreamRequest", + fields, + file_descriptor_proto() + ) + }) + } + } + + fn default_instance() -> &'static ReadStreamRequest { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ReadStreamRequest, + }; + unsafe { + instance.get(ReadStreamRequest::new) + } + } +} + +impl ::protobuf::Clear for ReadStreamRequest { + fn clear(&mut self) { + self.container_id.clear(); + self.exec_id.clear(); + self.len = 0; + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for ReadStreamRequest { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for ReadStreamRequest { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct ReadStreamResponse { + // message fields + pub data: ::std::vec::Vec, + // special fields + pub unknown_fields: ::protobuf::UnknownFields, + pub cached_size: ::protobuf::CachedSize, +} + +impl<'a> ::std::default::Default for &'a ReadStreamResponse { + fn default() -> &'a ReadStreamResponse { + ::default_instance() + } +} + +impl ReadStreamResponse { + pub fn new() -> ReadStreamResponse { + ::std::default::Default::default() + } + + // bytes data = 1; + + + pub fn get_data(&self) -> &[u8] { + &self.data + } + pub fn clear_data(&mut self) { + self.data.clear(); + } + + // Param is passed by value, moved + pub fn set_data(&mut self, v: ::std::vec::Vec) { + self.data = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_data(&mut self) -> &mut ::std::vec::Vec { + &mut self.data + } + + // Take field + pub fn take_data(&mut self) -> ::std::vec::Vec { + ::std::mem::replace(&mut self.data, ::std::vec::Vec::new()) + } +} + +impl ::protobuf::Message for ReadStreamResponse { + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_proto3_bytes_into(wire_type, is, &mut self.data)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if !self.data.is_empty() { + my_size += ::protobuf::rt::bytes_size(1, &self.data); + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if !self.data.is_empty() { + os.write_bytes(1, &self.data)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> ReadStreamResponse { + ReadStreamResponse::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( + "data", + |m: &ReadStreamResponse| { &m.data }, + |m: &mut ReadStreamResponse| { &mut m.data }, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "ReadStreamResponse", + fields, + file_descriptor_proto() + ) + }) + } + } + + fn default_instance() -> &'static ReadStreamResponse { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ReadStreamResponse, + }; + unsafe { + instance.get(ReadStreamResponse::new) + } + } +} + +impl ::protobuf::Clear for ReadStreamResponse { + fn clear(&mut self) { + self.data.clear(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for ReadStreamResponse { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for ReadStreamResponse { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct CloseStdinRequest { + // message fields + pub container_id: ::std::string::String, + pub exec_id: ::std::string::String, + // special fields + pub unknown_fields: ::protobuf::UnknownFields, + pub cached_size: ::protobuf::CachedSize, +} + +impl<'a> ::std::default::Default for &'a CloseStdinRequest { + fn default() -> &'a CloseStdinRequest { + ::default_instance() + } +} + +impl CloseStdinRequest { + pub fn new() -> CloseStdinRequest { + ::std::default::Default::default() + } + + // string container_id = 1; + + + pub fn get_container_id(&self) -> &str { + &self.container_id + } + pub fn clear_container_id(&mut self) { + self.container_id.clear(); + } + + // Param is passed by value, moved + pub fn set_container_id(&mut self, v: ::std::string::String) { + self.container_id = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_container_id(&mut self) -> &mut ::std::string::String { + &mut self.container_id + } + + // Take field + pub fn take_container_id(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.container_id, ::std::string::String::new()) + } + + // string exec_id = 2; + + + pub fn get_exec_id(&self) -> &str { + &self.exec_id + } + pub fn clear_exec_id(&mut self) { + self.exec_id.clear(); + } + + // Param is passed by value, moved + pub fn set_exec_id(&mut self, v: ::std::string::String) { + self.exec_id = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_exec_id(&mut self) -> &mut ::std::string::String { + &mut self.exec_id + } + + // Take field + pub fn take_exec_id(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.exec_id, ::std::string::String::new()) + } +} + +impl ::protobuf::Message for CloseStdinRequest { + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.container_id)?; + }, + 2 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.exec_id)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if !self.container_id.is_empty() { + my_size += ::protobuf::rt::string_size(1, &self.container_id); + } + if !self.exec_id.is_empty() { + my_size += ::protobuf::rt::string_size(2, &self.exec_id); + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if !self.container_id.is_empty() { + os.write_string(1, &self.container_id)?; + } + if !self.exec_id.is_empty() { + os.write_string(2, &self.exec_id)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> CloseStdinRequest { + CloseStdinRequest::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "container_id", + |m: &CloseStdinRequest| { &m.container_id }, + |m: &mut CloseStdinRequest| { &mut m.container_id }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "exec_id", + |m: &CloseStdinRequest| { &m.exec_id }, + |m: &mut CloseStdinRequest| { &mut m.exec_id }, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "CloseStdinRequest", + fields, + file_descriptor_proto() + ) + }) + } + } + + fn default_instance() -> &'static CloseStdinRequest { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const CloseStdinRequest, + }; + unsafe { + instance.get(CloseStdinRequest::new) + } + } +} + +impl ::protobuf::Clear for CloseStdinRequest { + fn clear(&mut self) { + self.container_id.clear(); + self.exec_id.clear(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for CloseStdinRequest { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for CloseStdinRequest { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct TtyWinResizeRequest { + // message fields + pub container_id: ::std::string::String, + pub exec_id: ::std::string::String, + pub row: u32, + pub column: u32, + // special fields + pub unknown_fields: ::protobuf::UnknownFields, + pub cached_size: ::protobuf::CachedSize, +} + +impl<'a> ::std::default::Default for &'a TtyWinResizeRequest { + fn default() -> &'a TtyWinResizeRequest { + ::default_instance() + } +} + +impl TtyWinResizeRequest { + pub fn new() -> TtyWinResizeRequest { + ::std::default::Default::default() + } + + // string container_id = 1; + + + pub fn get_container_id(&self) -> &str { + &self.container_id + } + pub fn clear_container_id(&mut self) { + self.container_id.clear(); + } + + // Param is passed by value, moved + pub fn set_container_id(&mut self, v: ::std::string::String) { + self.container_id = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_container_id(&mut self) -> &mut ::std::string::String { + &mut self.container_id + } + + // Take field + pub fn take_container_id(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.container_id, ::std::string::String::new()) + } + + // string exec_id = 2; + + + pub fn get_exec_id(&self) -> &str { + &self.exec_id + } + pub fn clear_exec_id(&mut self) { + self.exec_id.clear(); + } + + // Param is passed by value, moved + pub fn set_exec_id(&mut self, v: ::std::string::String) { + self.exec_id = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_exec_id(&mut self) -> &mut ::std::string::String { + &mut self.exec_id + } + + // Take field + pub fn take_exec_id(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.exec_id, ::std::string::String::new()) + } + + // uint32 row = 3; + + + pub fn get_row(&self) -> u32 { + self.row + } + pub fn clear_row(&mut self) { + self.row = 0; + } + + // Param is passed by value, moved + pub fn set_row(&mut self, v: u32) { + self.row = v; + } + + // uint32 column = 4; + + + pub fn get_column(&self) -> u32 { + self.column + } + pub fn clear_column(&mut self) { + self.column = 0; + } + + // Param is passed by value, moved + pub fn set_column(&mut self, v: u32) { + self.column = v; + } +} + +impl ::protobuf::Message for TtyWinResizeRequest { + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.container_id)?; + }, + 2 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.exec_id)?; + }, + 3 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint32()?; + self.row = tmp; + }, + 4 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint32()?; + self.column = tmp; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if !self.container_id.is_empty() { + my_size += ::protobuf::rt::string_size(1, &self.container_id); + } + if !self.exec_id.is_empty() { + my_size += ::protobuf::rt::string_size(2, &self.exec_id); + } + if self.row != 0 { + my_size += ::protobuf::rt::value_size(3, self.row, ::protobuf::wire_format::WireTypeVarint); + } + if self.column != 0 { + my_size += ::protobuf::rt::value_size(4, self.column, ::protobuf::wire_format::WireTypeVarint); + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if !self.container_id.is_empty() { + os.write_string(1, &self.container_id)?; + } + if !self.exec_id.is_empty() { + os.write_string(2, &self.exec_id)?; + } + if self.row != 0 { + os.write_uint32(3, self.row)?; + } + if self.column != 0 { + os.write_uint32(4, self.column)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> TtyWinResizeRequest { + TtyWinResizeRequest::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "container_id", + |m: &TtyWinResizeRequest| { &m.container_id }, + |m: &mut TtyWinResizeRequest| { &mut m.container_id }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "exec_id", + |m: &TtyWinResizeRequest| { &m.exec_id }, + |m: &mut TtyWinResizeRequest| { &mut m.exec_id }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint32>( + "row", + |m: &TtyWinResizeRequest| { &m.row }, + |m: &mut TtyWinResizeRequest| { &mut m.row }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint32>( + "column", + |m: &TtyWinResizeRequest| { &m.column }, + |m: &mut TtyWinResizeRequest| { &mut m.column }, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "TtyWinResizeRequest", + fields, + file_descriptor_proto() + ) + }) + } + } + + fn default_instance() -> &'static TtyWinResizeRequest { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const TtyWinResizeRequest, + }; + unsafe { + instance.get(TtyWinResizeRequest::new) + } + } +} + +impl ::protobuf::Clear for TtyWinResizeRequest { + fn clear(&mut self) { + self.container_id.clear(); + self.exec_id.clear(); + self.row = 0; + self.column = 0; + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for TtyWinResizeRequest { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for TtyWinResizeRequest { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct CreateSandboxRequest { + // message fields + pub hostname: ::std::string::String, + pub dns: ::protobuf::RepeatedField<::std::string::String>, + pub storages: ::protobuf::RepeatedField, + pub sandbox_pidns: bool, + pub sandbox_id: ::std::string::String, + pub guest_hook_path: ::std::string::String, + // special fields + pub unknown_fields: ::protobuf::UnknownFields, + pub cached_size: ::protobuf::CachedSize, +} + +impl<'a> ::std::default::Default for &'a CreateSandboxRequest { + fn default() -> &'a CreateSandboxRequest { + ::default_instance() + } +} + +impl CreateSandboxRequest { + pub fn new() -> CreateSandboxRequest { + ::std::default::Default::default() + } + + // string hostname = 1; + + + pub fn get_hostname(&self) -> &str { + &self.hostname + } + pub fn clear_hostname(&mut self) { + self.hostname.clear(); + } + + // Param is passed by value, moved + pub fn set_hostname(&mut self, v: ::std::string::String) { + self.hostname = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_hostname(&mut self) -> &mut ::std::string::String { + &mut self.hostname + } + + // Take field + pub fn take_hostname(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.hostname, ::std::string::String::new()) + } + + // repeated string dns = 2; + + + pub fn get_dns(&self) -> &[::std::string::String] { + &self.dns + } + pub fn clear_dns(&mut self) { + self.dns.clear(); + } + + // Param is passed by value, moved + pub fn set_dns(&mut self, v: ::protobuf::RepeatedField<::std::string::String>) { + self.dns = v; + } + + // Mutable pointer to the field. + pub fn mut_dns(&mut self) -> &mut ::protobuf::RepeatedField<::std::string::String> { + &mut self.dns + } + + // Take field + pub fn take_dns(&mut self) -> ::protobuf::RepeatedField<::std::string::String> { + ::std::mem::replace(&mut self.dns, ::protobuf::RepeatedField::new()) + } + + // repeated .grpc.Storage storages = 3; + + + pub fn get_storages(&self) -> &[Storage] { + &self.storages + } + pub fn clear_storages(&mut self) { + self.storages.clear(); + } + + // Param is passed by value, moved + pub fn set_storages(&mut self, v: ::protobuf::RepeatedField) { + self.storages = v; + } + + // Mutable pointer to the field. + pub fn mut_storages(&mut self) -> &mut ::protobuf::RepeatedField { + &mut self.storages + } + + // Take field + pub fn take_storages(&mut self) -> ::protobuf::RepeatedField { + ::std::mem::replace(&mut self.storages, ::protobuf::RepeatedField::new()) + } + + // bool sandbox_pidns = 4; + + + pub fn get_sandbox_pidns(&self) -> bool { + self.sandbox_pidns + } + pub fn clear_sandbox_pidns(&mut self) { + self.sandbox_pidns = false; + } + + // Param is passed by value, moved + pub fn set_sandbox_pidns(&mut self, v: bool) { + self.sandbox_pidns = v; + } + + // string sandbox_id = 5; + + + pub fn get_sandbox_id(&self) -> &str { + &self.sandbox_id + } + pub fn clear_sandbox_id(&mut self) { + self.sandbox_id.clear(); + } + + // Param is passed by value, moved + pub fn set_sandbox_id(&mut self, v: ::std::string::String) { + self.sandbox_id = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_sandbox_id(&mut self) -> &mut ::std::string::String { + &mut self.sandbox_id + } + + // Take field + pub fn take_sandbox_id(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.sandbox_id, ::std::string::String::new()) + } + + // string guest_hook_path = 6; + + + pub fn get_guest_hook_path(&self) -> &str { + &self.guest_hook_path + } + pub fn clear_guest_hook_path(&mut self) { + self.guest_hook_path.clear(); + } + + // Param is passed by value, moved + pub fn set_guest_hook_path(&mut self, v: ::std::string::String) { + self.guest_hook_path = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_guest_hook_path(&mut self) -> &mut ::std::string::String { + &mut self.guest_hook_path + } + + // Take field + pub fn take_guest_hook_path(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.guest_hook_path, ::std::string::String::new()) + } +} + +impl ::protobuf::Message for CreateSandboxRequest { + fn is_initialized(&self) -> bool { + for v in &self.storages { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.hostname)?; + }, + 2 => { + ::protobuf::rt::read_repeated_string_into(wire_type, is, &mut self.dns)?; + }, + 3 => { + ::protobuf::rt::read_repeated_message_into(wire_type, is, &mut self.storages)?; + }, + 4 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_bool()?; + self.sandbox_pidns = tmp; + }, + 5 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.sandbox_id)?; + }, + 6 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.guest_hook_path)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if !self.hostname.is_empty() { + my_size += ::protobuf::rt::string_size(1, &self.hostname); + } + for value in &self.dns { + my_size += ::protobuf::rt::string_size(2, &value); + }; + for value in &self.storages { + let len = value.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + }; + if self.sandbox_pidns != false { + my_size += 2; + } + if !self.sandbox_id.is_empty() { + my_size += ::protobuf::rt::string_size(5, &self.sandbox_id); + } + if !self.guest_hook_path.is_empty() { + my_size += ::protobuf::rt::string_size(6, &self.guest_hook_path); + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if !self.hostname.is_empty() { + os.write_string(1, &self.hostname)?; + } + for v in &self.dns { + os.write_string(2, &v)?; + }; + for v in &self.storages { + os.write_tag(3, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + }; + if self.sandbox_pidns != false { + os.write_bool(4, self.sandbox_pidns)?; + } + if !self.sandbox_id.is_empty() { + os.write_string(5, &self.sandbox_id)?; + } + if !self.guest_hook_path.is_empty() { + os.write_string(6, &self.guest_hook_path)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> CreateSandboxRequest { + CreateSandboxRequest::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "hostname", + |m: &CreateSandboxRequest| { &m.hostname }, + |m: &mut CreateSandboxRequest| { &mut m.hostname }, + )); + fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "dns", + |m: &CreateSandboxRequest| { &m.dns }, + |m: &mut CreateSandboxRequest| { &mut m.dns }, + )); + fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "storages", + |m: &CreateSandboxRequest| { &m.storages }, + |m: &mut CreateSandboxRequest| { &mut m.storages }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeBool>( + "sandbox_pidns", + |m: &CreateSandboxRequest| { &m.sandbox_pidns }, + |m: &mut CreateSandboxRequest| { &mut m.sandbox_pidns }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "sandbox_id", + |m: &CreateSandboxRequest| { &m.sandbox_id }, + |m: &mut CreateSandboxRequest| { &mut m.sandbox_id }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "guest_hook_path", + |m: &CreateSandboxRequest| { &m.guest_hook_path }, + |m: &mut CreateSandboxRequest| { &mut m.guest_hook_path }, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "CreateSandboxRequest", + fields, + file_descriptor_proto() + ) + }) + } + } + + fn default_instance() -> &'static CreateSandboxRequest { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const CreateSandboxRequest, + }; + unsafe { + instance.get(CreateSandboxRequest::new) + } + } +} + +impl ::protobuf::Clear for CreateSandboxRequest { + fn clear(&mut self) { + self.hostname.clear(); + self.dns.clear(); + self.storages.clear(); + self.sandbox_pidns = false; + self.sandbox_id.clear(); + self.guest_hook_path.clear(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for CreateSandboxRequest { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for CreateSandboxRequest { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct DestroySandboxRequest { + // special fields + pub unknown_fields: ::protobuf::UnknownFields, + pub cached_size: ::protobuf::CachedSize, +} + +impl<'a> ::std::default::Default for &'a DestroySandboxRequest { + fn default() -> &'a DestroySandboxRequest { + ::default_instance() + } +} + +impl DestroySandboxRequest { + pub fn new() -> DestroySandboxRequest { + ::std::default::Default::default() + } +} + +impl ::protobuf::Message for DestroySandboxRequest { + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> DestroySandboxRequest { + DestroySandboxRequest::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let fields = ::std::vec::Vec::new(); + ::protobuf::reflect::MessageDescriptor::new::( + "DestroySandboxRequest", + fields, + file_descriptor_proto() + ) + }) + } + } + + fn default_instance() -> &'static DestroySandboxRequest { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const DestroySandboxRequest, + }; + unsafe { + instance.get(DestroySandboxRequest::new) + } + } +} + +impl ::protobuf::Clear for DestroySandboxRequest { + fn clear(&mut self) { + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for DestroySandboxRequest { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for DestroySandboxRequest { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct Interfaces { + // message fields + pub Interfaces: ::protobuf::RepeatedField, + // special fields + pub unknown_fields: ::protobuf::UnknownFields, + pub cached_size: ::protobuf::CachedSize, +} + +impl<'a> ::std::default::Default for &'a Interfaces { + fn default() -> &'a Interfaces { + ::default_instance() + } +} + +impl Interfaces { + pub fn new() -> Interfaces { + ::std::default::Default::default() + } + + // repeated .types.Interface Interfaces = 1; + + + pub fn get_Interfaces(&self) -> &[super::types::Interface] { + &self.Interfaces + } + pub fn clear_Interfaces(&mut self) { + self.Interfaces.clear(); + } + + // Param is passed by value, moved + pub fn set_Interfaces(&mut self, v: ::protobuf::RepeatedField) { + self.Interfaces = v; + } + + // Mutable pointer to the field. + pub fn mut_Interfaces(&mut self) -> &mut ::protobuf::RepeatedField { + &mut self.Interfaces + } + + // Take field + pub fn take_Interfaces(&mut self) -> ::protobuf::RepeatedField { + ::std::mem::replace(&mut self.Interfaces, ::protobuf::RepeatedField::new()) + } +} + +impl ::protobuf::Message for Interfaces { + fn is_initialized(&self) -> bool { + for v in &self.Interfaces { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_repeated_message_into(wire_type, is, &mut self.Interfaces)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + for value in &self.Interfaces { + let len = value.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + }; + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + for v in &self.Interfaces { + os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + }; + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> Interfaces { + Interfaces::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "Interfaces", + |m: &Interfaces| { &m.Interfaces }, + |m: &mut Interfaces| { &mut m.Interfaces }, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "Interfaces", + fields, + file_descriptor_proto() + ) + }) + } + } + + fn default_instance() -> &'static Interfaces { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const Interfaces, + }; + unsafe { + instance.get(Interfaces::new) + } + } +} + +impl ::protobuf::Clear for Interfaces { + fn clear(&mut self) { + self.Interfaces.clear(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for Interfaces { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for Interfaces { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct Routes { + // message fields + pub Routes: ::protobuf::RepeatedField, + // special fields + pub unknown_fields: ::protobuf::UnknownFields, + pub cached_size: ::protobuf::CachedSize, +} + +impl<'a> ::std::default::Default for &'a Routes { + fn default() -> &'a Routes { + ::default_instance() + } +} + +impl Routes { + pub fn new() -> Routes { + ::std::default::Default::default() + } + + // repeated .types.Route Routes = 1; + + + pub fn get_Routes(&self) -> &[super::types::Route] { + &self.Routes + } + pub fn clear_Routes(&mut self) { + self.Routes.clear(); + } + + // Param is passed by value, moved + pub fn set_Routes(&mut self, v: ::protobuf::RepeatedField) { + self.Routes = v; + } + + // Mutable pointer to the field. + pub fn mut_Routes(&mut self) -> &mut ::protobuf::RepeatedField { + &mut self.Routes + } + + // Take field + pub fn take_Routes(&mut self) -> ::protobuf::RepeatedField { + ::std::mem::replace(&mut self.Routes, ::protobuf::RepeatedField::new()) + } +} + +impl ::protobuf::Message for Routes { + fn is_initialized(&self) -> bool { + for v in &self.Routes { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_repeated_message_into(wire_type, is, &mut self.Routes)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + for value in &self.Routes { + let len = value.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + }; + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + for v in &self.Routes { + os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + }; + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> Routes { + Routes::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "Routes", + |m: &Routes| { &m.Routes }, + |m: &mut Routes| { &mut m.Routes }, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "Routes", + fields, + file_descriptor_proto() + ) + }) + } + } + + fn default_instance() -> &'static Routes { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const Routes, + }; + unsafe { + instance.get(Routes::new) + } + } +} + +impl ::protobuf::Clear for Routes { + fn clear(&mut self) { + self.Routes.clear(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for Routes { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for Routes { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct UpdateInterfaceRequest { + // message fields + pub interface: ::protobuf::SingularPtrField, + // special fields + pub unknown_fields: ::protobuf::UnknownFields, + pub cached_size: ::protobuf::CachedSize, +} + +impl<'a> ::std::default::Default for &'a UpdateInterfaceRequest { + fn default() -> &'a UpdateInterfaceRequest { + ::default_instance() + } +} + +impl UpdateInterfaceRequest { + pub fn new() -> UpdateInterfaceRequest { + ::std::default::Default::default() + } + + // .types.Interface interface = 1; + + + pub fn get_interface(&self) -> &super::types::Interface { + self.interface.as_ref().unwrap_or_else(|| super::types::Interface::default_instance()) + } + pub fn clear_interface(&mut self) { + self.interface.clear(); + } + + pub fn has_interface(&self) -> bool { + self.interface.is_some() + } + + // Param is passed by value, moved + pub fn set_interface(&mut self, v: super::types::Interface) { + self.interface = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_interface(&mut self) -> &mut super::types::Interface { + if self.interface.is_none() { + self.interface.set_default(); + } + self.interface.as_mut().unwrap() + } + + // Take field + pub fn take_interface(&mut self) -> super::types::Interface { + self.interface.take().unwrap_or_else(|| super::types::Interface::new()) + } +} + +impl ::protobuf::Message for UpdateInterfaceRequest { + fn is_initialized(&self) -> bool { + for v in &self.interface { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.interface)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if let Some(ref v) = self.interface.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if let Some(ref v) = self.interface.as_ref() { + os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> UpdateInterfaceRequest { + UpdateInterfaceRequest::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "interface", + |m: &UpdateInterfaceRequest| { &m.interface }, + |m: &mut UpdateInterfaceRequest| { &mut m.interface }, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "UpdateInterfaceRequest", + fields, + file_descriptor_proto() + ) + }) + } + } + + fn default_instance() -> &'static UpdateInterfaceRequest { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const UpdateInterfaceRequest, + }; + unsafe { + instance.get(UpdateInterfaceRequest::new) + } + } +} + +impl ::protobuf::Clear for UpdateInterfaceRequest { + fn clear(&mut self) { + self.interface.clear(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for UpdateInterfaceRequest { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for UpdateInterfaceRequest { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct UpdateRoutesRequest { + // message fields + pub routes: ::protobuf::SingularPtrField, + // special fields + pub unknown_fields: ::protobuf::UnknownFields, + pub cached_size: ::protobuf::CachedSize, +} + +impl<'a> ::std::default::Default for &'a UpdateRoutesRequest { + fn default() -> &'a UpdateRoutesRequest { + ::default_instance() + } +} + +impl UpdateRoutesRequest { + pub fn new() -> UpdateRoutesRequest { + ::std::default::Default::default() + } + + // .grpc.Routes routes = 1; + + + pub fn get_routes(&self) -> &Routes { + self.routes.as_ref().unwrap_or_else(|| Routes::default_instance()) + } + pub fn clear_routes(&mut self) { + self.routes.clear(); + } + + pub fn has_routes(&self) -> bool { + self.routes.is_some() + } + + // Param is passed by value, moved + pub fn set_routes(&mut self, v: Routes) { + self.routes = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_routes(&mut self) -> &mut Routes { + if self.routes.is_none() { + self.routes.set_default(); + } + self.routes.as_mut().unwrap() + } + + // Take field + pub fn take_routes(&mut self) -> Routes { + self.routes.take().unwrap_or_else(|| Routes::new()) + } +} + +impl ::protobuf::Message for UpdateRoutesRequest { + fn is_initialized(&self) -> bool { + for v in &self.routes { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.routes)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if let Some(ref v) = self.routes.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if let Some(ref v) = self.routes.as_ref() { + os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> UpdateRoutesRequest { + UpdateRoutesRequest::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "routes", + |m: &UpdateRoutesRequest| { &m.routes }, + |m: &mut UpdateRoutesRequest| { &mut m.routes }, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "UpdateRoutesRequest", + fields, + file_descriptor_proto() + ) + }) + } + } + + fn default_instance() -> &'static UpdateRoutesRequest { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const UpdateRoutesRequest, + }; + unsafe { + instance.get(UpdateRoutesRequest::new) + } + } +} + +impl ::protobuf::Clear for UpdateRoutesRequest { + fn clear(&mut self) { + self.routes.clear(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for UpdateRoutesRequest { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for UpdateRoutesRequest { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct ListInterfacesRequest { + // special fields + pub unknown_fields: ::protobuf::UnknownFields, + pub cached_size: ::protobuf::CachedSize, +} + +impl<'a> ::std::default::Default for &'a ListInterfacesRequest { + fn default() -> &'a ListInterfacesRequest { + ::default_instance() + } +} + +impl ListInterfacesRequest { + pub fn new() -> ListInterfacesRequest { + ::std::default::Default::default() + } +} + +impl ::protobuf::Message for ListInterfacesRequest { + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> ListInterfacesRequest { + ListInterfacesRequest::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let fields = ::std::vec::Vec::new(); + ::protobuf::reflect::MessageDescriptor::new::( + "ListInterfacesRequest", + fields, + file_descriptor_proto() + ) + }) + } + } + + fn default_instance() -> &'static ListInterfacesRequest { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ListInterfacesRequest, + }; + unsafe { + instance.get(ListInterfacesRequest::new) + } + } +} + +impl ::protobuf::Clear for ListInterfacesRequest { + fn clear(&mut self) { + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for ListInterfacesRequest { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for ListInterfacesRequest { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct ListRoutesRequest { + // special fields + pub unknown_fields: ::protobuf::UnknownFields, + pub cached_size: ::protobuf::CachedSize, +} + +impl<'a> ::std::default::Default for &'a ListRoutesRequest { + fn default() -> &'a ListRoutesRequest { + ::default_instance() + } +} + +impl ListRoutesRequest { + pub fn new() -> ListRoutesRequest { + ::std::default::Default::default() + } +} + +impl ::protobuf::Message for ListRoutesRequest { + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> ListRoutesRequest { + ListRoutesRequest::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let fields = ::std::vec::Vec::new(); + ::protobuf::reflect::MessageDescriptor::new::( + "ListRoutesRequest", + fields, + file_descriptor_proto() + ) + }) + } + } + + fn default_instance() -> &'static ListRoutesRequest { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ListRoutesRequest, + }; + unsafe { + instance.get(ListRoutesRequest::new) + } + } +} + +impl ::protobuf::Clear for ListRoutesRequest { + fn clear(&mut self) { + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for ListRoutesRequest { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for ListRoutesRequest { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct OnlineCPUMemRequest { + // message fields + pub wait: bool, + pub nb_cpus: u32, + pub cpu_only: bool, + // special fields + pub unknown_fields: ::protobuf::UnknownFields, + pub cached_size: ::protobuf::CachedSize, +} + +impl<'a> ::std::default::Default for &'a OnlineCPUMemRequest { + fn default() -> &'a OnlineCPUMemRequest { + ::default_instance() + } +} + +impl OnlineCPUMemRequest { + pub fn new() -> OnlineCPUMemRequest { + ::std::default::Default::default() + } + + // bool wait = 1; + + + pub fn get_wait(&self) -> bool { + self.wait + } + pub fn clear_wait(&mut self) { + self.wait = false; + } + + // Param is passed by value, moved + pub fn set_wait(&mut self, v: bool) { + self.wait = v; + } + + // uint32 nb_cpus = 2; + + + pub fn get_nb_cpus(&self) -> u32 { + self.nb_cpus + } + pub fn clear_nb_cpus(&mut self) { + self.nb_cpus = 0; + } + + // Param is passed by value, moved + pub fn set_nb_cpus(&mut self, v: u32) { + self.nb_cpus = v; + } + + // bool cpu_only = 3; + + + pub fn get_cpu_only(&self) -> bool { + self.cpu_only + } + pub fn clear_cpu_only(&mut self) { + self.cpu_only = false; + } + + // Param is passed by value, moved + pub fn set_cpu_only(&mut self, v: bool) { + self.cpu_only = v; + } +} + +impl ::protobuf::Message for OnlineCPUMemRequest { + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_bool()?; + self.wait = tmp; + }, + 2 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint32()?; + self.nb_cpus = tmp; + }, + 3 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_bool()?; + self.cpu_only = tmp; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if self.wait != false { + my_size += 2; + } + if self.nb_cpus != 0 { + my_size += ::protobuf::rt::value_size(2, self.nb_cpus, ::protobuf::wire_format::WireTypeVarint); + } + if self.cpu_only != false { + my_size += 2; + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if self.wait != false { + os.write_bool(1, self.wait)?; + } + if self.nb_cpus != 0 { + os.write_uint32(2, self.nb_cpus)?; + } + if self.cpu_only != false { + os.write_bool(3, self.cpu_only)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> OnlineCPUMemRequest { + OnlineCPUMemRequest::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeBool>( + "wait", + |m: &OnlineCPUMemRequest| { &m.wait }, + |m: &mut OnlineCPUMemRequest| { &mut m.wait }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint32>( + "nb_cpus", + |m: &OnlineCPUMemRequest| { &m.nb_cpus }, + |m: &mut OnlineCPUMemRequest| { &mut m.nb_cpus }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeBool>( + "cpu_only", + |m: &OnlineCPUMemRequest| { &m.cpu_only }, + |m: &mut OnlineCPUMemRequest| { &mut m.cpu_only }, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "OnlineCPUMemRequest", + fields, + file_descriptor_proto() + ) + }) + } + } + + fn default_instance() -> &'static OnlineCPUMemRequest { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const OnlineCPUMemRequest, + }; + unsafe { + instance.get(OnlineCPUMemRequest::new) + } + } +} + +impl ::protobuf::Clear for OnlineCPUMemRequest { + fn clear(&mut self) { + self.wait = false; + self.nb_cpus = 0; + self.cpu_only = false; + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for OnlineCPUMemRequest { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for OnlineCPUMemRequest { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct ReseedRandomDevRequest { + // message fields + pub data: ::std::vec::Vec, + // special fields + pub unknown_fields: ::protobuf::UnknownFields, + pub cached_size: ::protobuf::CachedSize, +} + +impl<'a> ::std::default::Default for &'a ReseedRandomDevRequest { + fn default() -> &'a ReseedRandomDevRequest { + ::default_instance() + } +} + +impl ReseedRandomDevRequest { + pub fn new() -> ReseedRandomDevRequest { + ::std::default::Default::default() + } + + // bytes data = 2; + + + pub fn get_data(&self) -> &[u8] { + &self.data + } + pub fn clear_data(&mut self) { + self.data.clear(); + } + + // Param is passed by value, moved + pub fn set_data(&mut self, v: ::std::vec::Vec) { + self.data = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_data(&mut self) -> &mut ::std::vec::Vec { + &mut self.data + } + + // Take field + pub fn take_data(&mut self) -> ::std::vec::Vec { + ::std::mem::replace(&mut self.data, ::std::vec::Vec::new()) + } +} + +impl ::protobuf::Message for ReseedRandomDevRequest { + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 2 => { + ::protobuf::rt::read_singular_proto3_bytes_into(wire_type, is, &mut self.data)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if !self.data.is_empty() { + my_size += ::protobuf::rt::bytes_size(2, &self.data); + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if !self.data.is_empty() { + os.write_bytes(2, &self.data)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> ReseedRandomDevRequest { + ReseedRandomDevRequest::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( + "data", + |m: &ReseedRandomDevRequest| { &m.data }, + |m: &mut ReseedRandomDevRequest| { &mut m.data }, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "ReseedRandomDevRequest", + fields, + file_descriptor_proto() + ) + }) + } + } + + fn default_instance() -> &'static ReseedRandomDevRequest { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ReseedRandomDevRequest, + }; + unsafe { + instance.get(ReseedRandomDevRequest::new) + } + } +} + +impl ::protobuf::Clear for ReseedRandomDevRequest { + fn clear(&mut self) { + self.data.clear(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for ReseedRandomDevRequest { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for ReseedRandomDevRequest { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct AgentDetails { + // message fields + pub version: ::std::string::String, + pub init_daemon: bool, + pub device_handlers: ::protobuf::RepeatedField<::std::string::String>, + pub storage_handlers: ::protobuf::RepeatedField<::std::string::String>, + pub supports_seccomp: bool, + // special fields + pub unknown_fields: ::protobuf::UnknownFields, + pub cached_size: ::protobuf::CachedSize, +} + +impl<'a> ::std::default::Default for &'a AgentDetails { + fn default() -> &'a AgentDetails { + ::default_instance() + } +} + +impl AgentDetails { + pub fn new() -> AgentDetails { + ::std::default::Default::default() + } + + // string version = 1; + + + pub fn get_version(&self) -> &str { + &self.version + } + pub fn clear_version(&mut self) { + self.version.clear(); + } + + // Param is passed by value, moved + pub fn set_version(&mut self, v: ::std::string::String) { + self.version = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_version(&mut self) -> &mut ::std::string::String { + &mut self.version + } + + // Take field + pub fn take_version(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.version, ::std::string::String::new()) + } + + // bool init_daemon = 2; + + + pub fn get_init_daemon(&self) -> bool { + self.init_daemon + } + pub fn clear_init_daemon(&mut self) { + self.init_daemon = false; + } + + // Param is passed by value, moved + pub fn set_init_daemon(&mut self, v: bool) { + self.init_daemon = v; + } + + // repeated string device_handlers = 3; + + + pub fn get_device_handlers(&self) -> &[::std::string::String] { + &self.device_handlers + } + pub fn clear_device_handlers(&mut self) { + self.device_handlers.clear(); + } + + // Param is passed by value, moved + pub fn set_device_handlers(&mut self, v: ::protobuf::RepeatedField<::std::string::String>) { + self.device_handlers = v; + } + + // Mutable pointer to the field. + pub fn mut_device_handlers(&mut self) -> &mut ::protobuf::RepeatedField<::std::string::String> { + &mut self.device_handlers + } + + // Take field + pub fn take_device_handlers(&mut self) -> ::protobuf::RepeatedField<::std::string::String> { + ::std::mem::replace(&mut self.device_handlers, ::protobuf::RepeatedField::new()) + } + + // repeated string storage_handlers = 4; + + + pub fn get_storage_handlers(&self) -> &[::std::string::String] { + &self.storage_handlers + } + pub fn clear_storage_handlers(&mut self) { + self.storage_handlers.clear(); + } + + // Param is passed by value, moved + pub fn set_storage_handlers(&mut self, v: ::protobuf::RepeatedField<::std::string::String>) { + self.storage_handlers = v; + } + + // Mutable pointer to the field. + pub fn mut_storage_handlers(&mut self) -> &mut ::protobuf::RepeatedField<::std::string::String> { + &mut self.storage_handlers + } + + // Take field + pub fn take_storage_handlers(&mut self) -> ::protobuf::RepeatedField<::std::string::String> { + ::std::mem::replace(&mut self.storage_handlers, ::protobuf::RepeatedField::new()) + } + + // bool supports_seccomp = 5; + + + pub fn get_supports_seccomp(&self) -> bool { + self.supports_seccomp + } + pub fn clear_supports_seccomp(&mut self) { + self.supports_seccomp = false; + } + + // Param is passed by value, moved + pub fn set_supports_seccomp(&mut self, v: bool) { + self.supports_seccomp = v; + } +} + +impl ::protobuf::Message for AgentDetails { + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.version)?; + }, + 2 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_bool()?; + self.init_daemon = tmp; + }, + 3 => { + ::protobuf::rt::read_repeated_string_into(wire_type, is, &mut self.device_handlers)?; + }, + 4 => { + ::protobuf::rt::read_repeated_string_into(wire_type, is, &mut self.storage_handlers)?; + }, + 5 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_bool()?; + self.supports_seccomp = tmp; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if !self.version.is_empty() { + my_size += ::protobuf::rt::string_size(1, &self.version); + } + if self.init_daemon != false { + my_size += 2; + } + for value in &self.device_handlers { + my_size += ::protobuf::rt::string_size(3, &value); + }; + for value in &self.storage_handlers { + my_size += ::protobuf::rt::string_size(4, &value); + }; + if self.supports_seccomp != false { + my_size += 2; + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if !self.version.is_empty() { + os.write_string(1, &self.version)?; + } + if self.init_daemon != false { + os.write_bool(2, self.init_daemon)?; + } + for v in &self.device_handlers { + os.write_string(3, &v)?; + }; + for v in &self.storage_handlers { + os.write_string(4, &v)?; + }; + if self.supports_seccomp != false { + os.write_bool(5, self.supports_seccomp)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> AgentDetails { + AgentDetails::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "version", + |m: &AgentDetails| { &m.version }, + |m: &mut AgentDetails| { &mut m.version }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeBool>( + "init_daemon", + |m: &AgentDetails| { &m.init_daemon }, + |m: &mut AgentDetails| { &mut m.init_daemon }, + )); + fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "device_handlers", + |m: &AgentDetails| { &m.device_handlers }, + |m: &mut AgentDetails| { &mut m.device_handlers }, + )); + fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "storage_handlers", + |m: &AgentDetails| { &m.storage_handlers }, + |m: &mut AgentDetails| { &mut m.storage_handlers }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeBool>( + "supports_seccomp", + |m: &AgentDetails| { &m.supports_seccomp }, + |m: &mut AgentDetails| { &mut m.supports_seccomp }, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "AgentDetails", + fields, + file_descriptor_proto() + ) + }) + } + } + + fn default_instance() -> &'static AgentDetails { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const AgentDetails, + }; + unsafe { + instance.get(AgentDetails::new) + } + } +} + +impl ::protobuf::Clear for AgentDetails { + fn clear(&mut self) { + self.version.clear(); + self.init_daemon = false; + self.device_handlers.clear(); + self.storage_handlers.clear(); + self.supports_seccomp = false; + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for AgentDetails { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for AgentDetails { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct GuestDetailsRequest { + // message fields + pub mem_block_size: bool, + pub mem_hotplug_probe: bool, + // special fields + pub unknown_fields: ::protobuf::UnknownFields, + pub cached_size: ::protobuf::CachedSize, +} + +impl<'a> ::std::default::Default for &'a GuestDetailsRequest { + fn default() -> &'a GuestDetailsRequest { + ::default_instance() + } +} + +impl GuestDetailsRequest { + pub fn new() -> GuestDetailsRequest { + ::std::default::Default::default() + } + + // bool mem_block_size = 1; + + + pub fn get_mem_block_size(&self) -> bool { + self.mem_block_size + } + pub fn clear_mem_block_size(&mut self) { + self.mem_block_size = false; + } + + // Param is passed by value, moved + pub fn set_mem_block_size(&mut self, v: bool) { + self.mem_block_size = v; + } + + // bool mem_hotplug_probe = 2; + + + pub fn get_mem_hotplug_probe(&self) -> bool { + self.mem_hotplug_probe + } + pub fn clear_mem_hotplug_probe(&mut self) { + self.mem_hotplug_probe = false; + } + + // Param is passed by value, moved + pub fn set_mem_hotplug_probe(&mut self, v: bool) { + self.mem_hotplug_probe = v; + } +} + +impl ::protobuf::Message for GuestDetailsRequest { + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_bool()?; + self.mem_block_size = tmp; + }, + 2 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_bool()?; + self.mem_hotplug_probe = tmp; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if self.mem_block_size != false { + my_size += 2; + } + if self.mem_hotplug_probe != false { + my_size += 2; + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if self.mem_block_size != false { + os.write_bool(1, self.mem_block_size)?; + } + if self.mem_hotplug_probe != false { + os.write_bool(2, self.mem_hotplug_probe)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> GuestDetailsRequest { + GuestDetailsRequest::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeBool>( + "mem_block_size", + |m: &GuestDetailsRequest| { &m.mem_block_size }, + |m: &mut GuestDetailsRequest| { &mut m.mem_block_size }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeBool>( + "mem_hotplug_probe", + |m: &GuestDetailsRequest| { &m.mem_hotplug_probe }, + |m: &mut GuestDetailsRequest| { &mut m.mem_hotplug_probe }, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "GuestDetailsRequest", + fields, + file_descriptor_proto() + ) + }) + } + } + + fn default_instance() -> &'static GuestDetailsRequest { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const GuestDetailsRequest, + }; + unsafe { + instance.get(GuestDetailsRequest::new) + } + } +} + +impl ::protobuf::Clear for GuestDetailsRequest { + fn clear(&mut self) { + self.mem_block_size = false; + self.mem_hotplug_probe = false; + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for GuestDetailsRequest { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for GuestDetailsRequest { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct GuestDetailsResponse { + // message fields + pub mem_block_size_bytes: u64, + pub agent_details: ::protobuf::SingularPtrField, + pub support_mem_hotplug_probe: bool, + // special fields + pub unknown_fields: ::protobuf::UnknownFields, + pub cached_size: ::protobuf::CachedSize, +} + +impl<'a> ::std::default::Default for &'a GuestDetailsResponse { + fn default() -> &'a GuestDetailsResponse { + ::default_instance() + } +} + +impl GuestDetailsResponse { + pub fn new() -> GuestDetailsResponse { + ::std::default::Default::default() + } + + // uint64 mem_block_size_bytes = 1; + + + pub fn get_mem_block_size_bytes(&self) -> u64 { + self.mem_block_size_bytes + } + pub fn clear_mem_block_size_bytes(&mut self) { + self.mem_block_size_bytes = 0; + } + + // Param is passed by value, moved + pub fn set_mem_block_size_bytes(&mut self, v: u64) { + self.mem_block_size_bytes = v; + } + + // .grpc.AgentDetails agent_details = 2; + + + pub fn get_agent_details(&self) -> &AgentDetails { + self.agent_details.as_ref().unwrap_or_else(|| AgentDetails::default_instance()) + } + pub fn clear_agent_details(&mut self) { + self.agent_details.clear(); + } + + pub fn has_agent_details(&self) -> bool { + self.agent_details.is_some() + } + + // Param is passed by value, moved + pub fn set_agent_details(&mut self, v: AgentDetails) { + self.agent_details = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_agent_details(&mut self) -> &mut AgentDetails { + if self.agent_details.is_none() { + self.agent_details.set_default(); + } + self.agent_details.as_mut().unwrap() + } + + // Take field + pub fn take_agent_details(&mut self) -> AgentDetails { + self.agent_details.take().unwrap_or_else(|| AgentDetails::new()) + } + + // bool support_mem_hotplug_probe = 3; + + + pub fn get_support_mem_hotplug_probe(&self) -> bool { + self.support_mem_hotplug_probe + } + pub fn clear_support_mem_hotplug_probe(&mut self) { + self.support_mem_hotplug_probe = false; + } + + // Param is passed by value, moved + pub fn set_support_mem_hotplug_probe(&mut self, v: bool) { + self.support_mem_hotplug_probe = v; + } +} + +impl ::protobuf::Message for GuestDetailsResponse { + fn is_initialized(&self) -> bool { + for v in &self.agent_details { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint64()?; + self.mem_block_size_bytes = tmp; + }, + 2 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.agent_details)?; + }, + 3 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_bool()?; + self.support_mem_hotplug_probe = tmp; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if self.mem_block_size_bytes != 0 { + my_size += ::protobuf::rt::value_size(1, self.mem_block_size_bytes, ::protobuf::wire_format::WireTypeVarint); + } + if let Some(ref v) = self.agent_details.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + if self.support_mem_hotplug_probe != false { + my_size += 2; + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if self.mem_block_size_bytes != 0 { + os.write_uint64(1, self.mem_block_size_bytes)?; + } + if let Some(ref v) = self.agent_details.as_ref() { + os.write_tag(2, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + if self.support_mem_hotplug_probe != false { + os.write_bool(3, self.support_mem_hotplug_probe)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> GuestDetailsResponse { + GuestDetailsResponse::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( + "mem_block_size_bytes", + |m: &GuestDetailsResponse| { &m.mem_block_size_bytes }, + |m: &mut GuestDetailsResponse| { &mut m.mem_block_size_bytes }, + )); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "agent_details", + |m: &GuestDetailsResponse| { &m.agent_details }, + |m: &mut GuestDetailsResponse| { &mut m.agent_details }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeBool>( + "support_mem_hotplug_probe", + |m: &GuestDetailsResponse| { &m.support_mem_hotplug_probe }, + |m: &mut GuestDetailsResponse| { &mut m.support_mem_hotplug_probe }, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "GuestDetailsResponse", + fields, + file_descriptor_proto() + ) + }) + } + } + + fn default_instance() -> &'static GuestDetailsResponse { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const GuestDetailsResponse, + }; + unsafe { + instance.get(GuestDetailsResponse::new) + } + } +} + +impl ::protobuf::Clear for GuestDetailsResponse { + fn clear(&mut self) { + self.mem_block_size_bytes = 0; + self.agent_details.clear(); + self.support_mem_hotplug_probe = false; + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for GuestDetailsResponse { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for GuestDetailsResponse { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct MemHotplugByProbeRequest { + // message fields + pub memHotplugProbeAddr: ::std::vec::Vec, + // special fields + pub unknown_fields: ::protobuf::UnknownFields, + pub cached_size: ::protobuf::CachedSize, +} + +impl<'a> ::std::default::Default for &'a MemHotplugByProbeRequest { + fn default() -> &'a MemHotplugByProbeRequest { + ::default_instance() + } +} + +impl MemHotplugByProbeRequest { + pub fn new() -> MemHotplugByProbeRequest { + ::std::default::Default::default() + } + + // repeated uint64 memHotplugProbeAddr = 1; + + + pub fn get_memHotplugProbeAddr(&self) -> &[u64] { + &self.memHotplugProbeAddr + } + pub fn clear_memHotplugProbeAddr(&mut self) { + self.memHotplugProbeAddr.clear(); + } + + // Param is passed by value, moved + pub fn set_memHotplugProbeAddr(&mut self, v: ::std::vec::Vec) { + self.memHotplugProbeAddr = v; + } + + // Mutable pointer to the field. + pub fn mut_memHotplugProbeAddr(&mut self) -> &mut ::std::vec::Vec { + &mut self.memHotplugProbeAddr + } + + // Take field + pub fn take_memHotplugProbeAddr(&mut self) -> ::std::vec::Vec { + ::std::mem::replace(&mut self.memHotplugProbeAddr, ::std::vec::Vec::new()) + } +} + +impl ::protobuf::Message for MemHotplugByProbeRequest { + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_repeated_uint64_into(wire_type, is, &mut self.memHotplugProbeAddr)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + for value in &self.memHotplugProbeAddr { + my_size += ::protobuf::rt::value_size(1, *value, ::protobuf::wire_format::WireTypeVarint); + }; + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + for v in &self.memHotplugProbeAddr { + os.write_uint64(1, *v)?; + }; + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> MemHotplugByProbeRequest { + MemHotplugByProbeRequest::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_vec_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( + "memHotplugProbeAddr", + |m: &MemHotplugByProbeRequest| { &m.memHotplugProbeAddr }, + |m: &mut MemHotplugByProbeRequest| { &mut m.memHotplugProbeAddr }, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "MemHotplugByProbeRequest", + fields, + file_descriptor_proto() + ) + }) + } + } + + fn default_instance() -> &'static MemHotplugByProbeRequest { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const MemHotplugByProbeRequest, + }; + unsafe { + instance.get(MemHotplugByProbeRequest::new) + } + } +} + +impl ::protobuf::Clear for MemHotplugByProbeRequest { + fn clear(&mut self) { + self.memHotplugProbeAddr.clear(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for MemHotplugByProbeRequest { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for MemHotplugByProbeRequest { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct SetGuestDateTimeRequest { + // message fields + pub Sec: i64, + pub Usec: i64, + // special fields + pub unknown_fields: ::protobuf::UnknownFields, + pub cached_size: ::protobuf::CachedSize, +} + +impl<'a> ::std::default::Default for &'a SetGuestDateTimeRequest { + fn default() -> &'a SetGuestDateTimeRequest { + ::default_instance() + } +} + +impl SetGuestDateTimeRequest { + pub fn new() -> SetGuestDateTimeRequest { + ::std::default::Default::default() + } + + // int64 Sec = 1; + + + pub fn get_Sec(&self) -> i64 { + self.Sec + } + pub fn clear_Sec(&mut self) { + self.Sec = 0; + } + + // Param is passed by value, moved + pub fn set_Sec(&mut self, v: i64) { + self.Sec = v; + } + + // int64 Usec = 2; + + + pub fn get_Usec(&self) -> i64 { + self.Usec + } + pub fn clear_Usec(&mut self) { + self.Usec = 0; + } + + // Param is passed by value, moved + pub fn set_Usec(&mut self, v: i64) { + self.Usec = v; + } +} + +impl ::protobuf::Message for SetGuestDateTimeRequest { + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_int64()?; + self.Sec = tmp; + }, + 2 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_int64()?; + self.Usec = tmp; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if self.Sec != 0 { + my_size += ::protobuf::rt::value_size(1, self.Sec, ::protobuf::wire_format::WireTypeVarint); + } + if self.Usec != 0 { + my_size += ::protobuf::rt::value_size(2, self.Usec, ::protobuf::wire_format::WireTypeVarint); + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if self.Sec != 0 { + os.write_int64(1, self.Sec)?; + } + if self.Usec != 0 { + os.write_int64(2, self.Usec)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> SetGuestDateTimeRequest { + SetGuestDateTimeRequest::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeInt64>( + "Sec", + |m: &SetGuestDateTimeRequest| { &m.Sec }, + |m: &mut SetGuestDateTimeRequest| { &mut m.Sec }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeInt64>( + "Usec", + |m: &SetGuestDateTimeRequest| { &m.Usec }, + |m: &mut SetGuestDateTimeRequest| { &mut m.Usec }, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "SetGuestDateTimeRequest", + fields, + file_descriptor_proto() + ) + }) + } + } + + fn default_instance() -> &'static SetGuestDateTimeRequest { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const SetGuestDateTimeRequest, + }; + unsafe { + instance.get(SetGuestDateTimeRequest::new) + } + } +} + +impl ::protobuf::Clear for SetGuestDateTimeRequest { + fn clear(&mut self) { + self.Sec = 0; + self.Usec = 0; + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for SetGuestDateTimeRequest { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for SetGuestDateTimeRequest { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct Storage { + // message fields + pub driver: ::std::string::String, + pub driver_options: ::protobuf::RepeatedField<::std::string::String>, + pub source: ::std::string::String, + pub fstype: ::std::string::String, + pub options: ::protobuf::RepeatedField<::std::string::String>, + pub mount_point: ::std::string::String, + // special fields + pub unknown_fields: ::protobuf::UnknownFields, + pub cached_size: ::protobuf::CachedSize, +} + +impl<'a> ::std::default::Default for &'a Storage { + fn default() -> &'a Storage { + ::default_instance() + } +} + +impl Storage { + pub fn new() -> Storage { + ::std::default::Default::default() + } + + // string driver = 1; + + + pub fn get_driver(&self) -> &str { + &self.driver + } + pub fn clear_driver(&mut self) { + self.driver.clear(); + } + + // Param is passed by value, moved + pub fn set_driver(&mut self, v: ::std::string::String) { + self.driver = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_driver(&mut self) -> &mut ::std::string::String { + &mut self.driver + } + + // Take field + pub fn take_driver(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.driver, ::std::string::String::new()) + } + + // repeated string driver_options = 2; + + + pub fn get_driver_options(&self) -> &[::std::string::String] { + &self.driver_options + } + pub fn clear_driver_options(&mut self) { + self.driver_options.clear(); + } + + // Param is passed by value, moved + pub fn set_driver_options(&mut self, v: ::protobuf::RepeatedField<::std::string::String>) { + self.driver_options = v; + } + + // Mutable pointer to the field. + pub fn mut_driver_options(&mut self) -> &mut ::protobuf::RepeatedField<::std::string::String> { + &mut self.driver_options + } + + // Take field + pub fn take_driver_options(&mut self) -> ::protobuf::RepeatedField<::std::string::String> { + ::std::mem::replace(&mut self.driver_options, ::protobuf::RepeatedField::new()) + } + + // string source = 3; + + + pub fn get_source(&self) -> &str { + &self.source + } + pub fn clear_source(&mut self) { + self.source.clear(); + } + + // Param is passed by value, moved + pub fn set_source(&mut self, v: ::std::string::String) { + self.source = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_source(&mut self) -> &mut ::std::string::String { + &mut self.source + } + + // Take field + pub fn take_source(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.source, ::std::string::String::new()) + } + + // string fstype = 4; + + + pub fn get_fstype(&self) -> &str { + &self.fstype + } + pub fn clear_fstype(&mut self) { + self.fstype.clear(); + } + + // Param is passed by value, moved + pub fn set_fstype(&mut self, v: ::std::string::String) { + self.fstype = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_fstype(&mut self) -> &mut ::std::string::String { + &mut self.fstype + } + + // Take field + pub fn take_fstype(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.fstype, ::std::string::String::new()) + } + + // repeated string options = 5; + + + pub fn get_options(&self) -> &[::std::string::String] { + &self.options + } + pub fn clear_options(&mut self) { + self.options.clear(); + } + + // Param is passed by value, moved + pub fn set_options(&mut self, v: ::protobuf::RepeatedField<::std::string::String>) { + self.options = v; + } + + // Mutable pointer to the field. + pub fn mut_options(&mut self) -> &mut ::protobuf::RepeatedField<::std::string::String> { + &mut self.options + } + + // Take field + pub fn take_options(&mut self) -> ::protobuf::RepeatedField<::std::string::String> { + ::std::mem::replace(&mut self.options, ::protobuf::RepeatedField::new()) + } + + // string mount_point = 6; + + + pub fn get_mount_point(&self) -> &str { + &self.mount_point + } + pub fn clear_mount_point(&mut self) { + self.mount_point.clear(); + } + + // Param is passed by value, moved + pub fn set_mount_point(&mut self, v: ::std::string::String) { + self.mount_point = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_mount_point(&mut self) -> &mut ::std::string::String { + &mut self.mount_point + } + + // Take field + pub fn take_mount_point(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.mount_point, ::std::string::String::new()) + } +} + +impl ::protobuf::Message for Storage { + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.driver)?; + }, + 2 => { + ::protobuf::rt::read_repeated_string_into(wire_type, is, &mut self.driver_options)?; + }, + 3 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.source)?; + }, + 4 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.fstype)?; + }, + 5 => { + ::protobuf::rt::read_repeated_string_into(wire_type, is, &mut self.options)?; + }, + 6 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.mount_point)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if !self.driver.is_empty() { + my_size += ::protobuf::rt::string_size(1, &self.driver); + } + for value in &self.driver_options { + my_size += ::protobuf::rt::string_size(2, &value); + }; + if !self.source.is_empty() { + my_size += ::protobuf::rt::string_size(3, &self.source); + } + if !self.fstype.is_empty() { + my_size += ::protobuf::rt::string_size(4, &self.fstype); + } + for value in &self.options { + my_size += ::protobuf::rt::string_size(5, &value); + }; + if !self.mount_point.is_empty() { + my_size += ::protobuf::rt::string_size(6, &self.mount_point); + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if !self.driver.is_empty() { + os.write_string(1, &self.driver)?; + } + for v in &self.driver_options { + os.write_string(2, &v)?; + }; + if !self.source.is_empty() { + os.write_string(3, &self.source)?; + } + if !self.fstype.is_empty() { + os.write_string(4, &self.fstype)?; + } + for v in &self.options { + os.write_string(5, &v)?; + }; + if !self.mount_point.is_empty() { + os.write_string(6, &self.mount_point)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> Storage { + Storage::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "driver", + |m: &Storage| { &m.driver }, + |m: &mut Storage| { &mut m.driver }, + )); + fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "driver_options", + |m: &Storage| { &m.driver_options }, + |m: &mut Storage| { &mut m.driver_options }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "source", + |m: &Storage| { &m.source }, + |m: &mut Storage| { &mut m.source }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "fstype", + |m: &Storage| { &m.fstype }, + |m: &mut Storage| { &mut m.fstype }, + )); + fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "options", + |m: &Storage| { &m.options }, + |m: &mut Storage| { &mut m.options }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "mount_point", + |m: &Storage| { &m.mount_point }, + |m: &mut Storage| { &mut m.mount_point }, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "Storage", + fields, + file_descriptor_proto() + ) + }) + } + } + + fn default_instance() -> &'static Storage { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const Storage, + }; + unsafe { + instance.get(Storage::new) + } + } +} + +impl ::protobuf::Clear for Storage { + fn clear(&mut self) { + self.driver.clear(); + self.driver_options.clear(); + self.source.clear(); + self.fstype.clear(); + self.options.clear(); + self.mount_point.clear(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for Storage { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for Storage { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct Device { + // message fields + pub id: ::std::string::String, + pub field_type: ::std::string::String, + pub vm_path: ::std::string::String, + pub container_path: ::std::string::String, + pub options: ::protobuf::RepeatedField<::std::string::String>, + // special fields + pub unknown_fields: ::protobuf::UnknownFields, + pub cached_size: ::protobuf::CachedSize, +} + +impl<'a> ::std::default::Default for &'a Device { + fn default() -> &'a Device { + ::default_instance() + } +} + +impl Device { + pub fn new() -> Device { + ::std::default::Default::default() + } + + // string id = 1; + + + pub fn get_id(&self) -> &str { + &self.id + } + pub fn clear_id(&mut self) { + self.id.clear(); + } + + // Param is passed by value, moved + pub fn set_id(&mut self, v: ::std::string::String) { + self.id = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_id(&mut self) -> &mut ::std::string::String { + &mut self.id + } + + // Take field + pub fn take_id(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.id, ::std::string::String::new()) + } + + // string type = 2; + + + pub fn get_field_type(&self) -> &str { + &self.field_type + } + pub fn clear_field_type(&mut self) { + self.field_type.clear(); + } + + // Param is passed by value, moved + pub fn set_field_type(&mut self, v: ::std::string::String) { + self.field_type = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_field_type(&mut self) -> &mut ::std::string::String { + &mut self.field_type + } + + // Take field + pub fn take_field_type(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.field_type, ::std::string::String::new()) + } + + // string vm_path = 3; + + + pub fn get_vm_path(&self) -> &str { + &self.vm_path + } + pub fn clear_vm_path(&mut self) { + self.vm_path.clear(); + } + + // Param is passed by value, moved + pub fn set_vm_path(&mut self, v: ::std::string::String) { + self.vm_path = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_vm_path(&mut self) -> &mut ::std::string::String { + &mut self.vm_path + } + + // Take field + pub fn take_vm_path(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.vm_path, ::std::string::String::new()) + } + + // string container_path = 4; + + + pub fn get_container_path(&self) -> &str { + &self.container_path + } + pub fn clear_container_path(&mut self) { + self.container_path.clear(); + } + + // Param is passed by value, moved + pub fn set_container_path(&mut self, v: ::std::string::String) { + self.container_path = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_container_path(&mut self) -> &mut ::std::string::String { + &mut self.container_path + } + + // Take field + pub fn take_container_path(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.container_path, ::std::string::String::new()) + } + + // repeated string options = 5; + + + pub fn get_options(&self) -> &[::std::string::String] { + &self.options + } + pub fn clear_options(&mut self) { + self.options.clear(); + } + + // Param is passed by value, moved + pub fn set_options(&mut self, v: ::protobuf::RepeatedField<::std::string::String>) { + self.options = v; + } + + // Mutable pointer to the field. + pub fn mut_options(&mut self) -> &mut ::protobuf::RepeatedField<::std::string::String> { + &mut self.options + } + + // Take field + pub fn take_options(&mut self) -> ::protobuf::RepeatedField<::std::string::String> { + ::std::mem::replace(&mut self.options, ::protobuf::RepeatedField::new()) + } +} + +impl ::protobuf::Message for Device { + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.id)?; + }, + 2 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.field_type)?; + }, + 3 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.vm_path)?; + }, + 4 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.container_path)?; + }, + 5 => { + ::protobuf::rt::read_repeated_string_into(wire_type, is, &mut self.options)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if !self.id.is_empty() { + my_size += ::protobuf::rt::string_size(1, &self.id); + } + if !self.field_type.is_empty() { + my_size += ::protobuf::rt::string_size(2, &self.field_type); + } + if !self.vm_path.is_empty() { + my_size += ::protobuf::rt::string_size(3, &self.vm_path); + } + if !self.container_path.is_empty() { + my_size += ::protobuf::rt::string_size(4, &self.container_path); + } + for value in &self.options { + my_size += ::protobuf::rt::string_size(5, &value); + }; + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if !self.id.is_empty() { + os.write_string(1, &self.id)?; + } + if !self.field_type.is_empty() { + os.write_string(2, &self.field_type)?; + } + if !self.vm_path.is_empty() { + os.write_string(3, &self.vm_path)?; + } + if !self.container_path.is_empty() { + os.write_string(4, &self.container_path)?; + } + for v in &self.options { + os.write_string(5, &v)?; + }; + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> Device { + Device::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "id", + |m: &Device| { &m.id }, + |m: &mut Device| { &mut m.id }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "type", + |m: &Device| { &m.field_type }, + |m: &mut Device| { &mut m.field_type }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "vm_path", + |m: &Device| { &m.vm_path }, + |m: &mut Device| { &mut m.vm_path }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "container_path", + |m: &Device| { &m.container_path }, + |m: &mut Device| { &mut m.container_path }, + )); + fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "options", + |m: &Device| { &m.options }, + |m: &mut Device| { &mut m.options }, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "Device", + fields, + file_descriptor_proto() + ) + }) + } + } + + fn default_instance() -> &'static Device { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const Device, + }; + unsafe { + instance.get(Device::new) + } + } +} + +impl ::protobuf::Clear for Device { + fn clear(&mut self) { + self.id.clear(); + self.field_type.clear(); + self.vm_path.clear(); + self.container_path.clear(); + self.options.clear(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for Device { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for Device { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct StringUser { + // message fields + pub uid: ::std::string::String, + pub gid: ::std::string::String, + pub additionalGids: ::protobuf::RepeatedField<::std::string::String>, + // special fields + pub unknown_fields: ::protobuf::UnknownFields, + pub cached_size: ::protobuf::CachedSize, +} + +impl<'a> ::std::default::Default for &'a StringUser { + fn default() -> &'a StringUser { + ::default_instance() + } +} + +impl StringUser { + pub fn new() -> StringUser { + ::std::default::Default::default() + } + + // string uid = 1; + + + pub fn get_uid(&self) -> &str { + &self.uid + } + pub fn clear_uid(&mut self) { + self.uid.clear(); + } + + // Param is passed by value, moved + pub fn set_uid(&mut self, v: ::std::string::String) { + self.uid = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_uid(&mut self) -> &mut ::std::string::String { + &mut self.uid + } + + // Take field + pub fn take_uid(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.uid, ::std::string::String::new()) + } + + // string gid = 2; + + + pub fn get_gid(&self) -> &str { + &self.gid + } + pub fn clear_gid(&mut self) { + self.gid.clear(); + } + + // Param is passed by value, moved + pub fn set_gid(&mut self, v: ::std::string::String) { + self.gid = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_gid(&mut self) -> &mut ::std::string::String { + &mut self.gid + } + + // Take field + pub fn take_gid(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.gid, ::std::string::String::new()) + } + + // repeated string additionalGids = 3; + + + pub fn get_additionalGids(&self) -> &[::std::string::String] { + &self.additionalGids + } + pub fn clear_additionalGids(&mut self) { + self.additionalGids.clear(); + } + + // Param is passed by value, moved + pub fn set_additionalGids(&mut self, v: ::protobuf::RepeatedField<::std::string::String>) { + self.additionalGids = v; + } + + // Mutable pointer to the field. + pub fn mut_additionalGids(&mut self) -> &mut ::protobuf::RepeatedField<::std::string::String> { + &mut self.additionalGids + } + + // Take field + pub fn take_additionalGids(&mut self) -> ::protobuf::RepeatedField<::std::string::String> { + ::std::mem::replace(&mut self.additionalGids, ::protobuf::RepeatedField::new()) + } +} + +impl ::protobuf::Message for StringUser { + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.uid)?; + }, + 2 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.gid)?; + }, + 3 => { + ::protobuf::rt::read_repeated_string_into(wire_type, is, &mut self.additionalGids)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if !self.uid.is_empty() { + my_size += ::protobuf::rt::string_size(1, &self.uid); + } + if !self.gid.is_empty() { + my_size += ::protobuf::rt::string_size(2, &self.gid); + } + for value in &self.additionalGids { + my_size += ::protobuf::rt::string_size(3, &value); + }; + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if !self.uid.is_empty() { + os.write_string(1, &self.uid)?; + } + if !self.gid.is_empty() { + os.write_string(2, &self.gid)?; + } + for v in &self.additionalGids { + os.write_string(3, &v)?; + }; + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> StringUser { + StringUser::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "uid", + |m: &StringUser| { &m.uid }, + |m: &mut StringUser| { &mut m.uid }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "gid", + |m: &StringUser| { &m.gid }, + |m: &mut StringUser| { &mut m.gid }, + )); + fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "additionalGids", + |m: &StringUser| { &m.additionalGids }, + |m: &mut StringUser| { &mut m.additionalGids }, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "StringUser", + fields, + file_descriptor_proto() + ) + }) + } + } + + fn default_instance() -> &'static StringUser { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const StringUser, + }; + unsafe { + instance.get(StringUser::new) + } + } +} + +impl ::protobuf::Clear for StringUser { + fn clear(&mut self) { + self.uid.clear(); + self.gid.clear(); + self.additionalGids.clear(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for StringUser { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for StringUser { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct CopyFileRequest { + // message fields + pub path: ::std::string::String, + pub file_size: i64, + pub file_mode: u32, + pub dir_mode: u32, + pub uid: i32, + pub gid: i32, + pub offset: i64, + pub data: ::std::vec::Vec, + // special fields + pub unknown_fields: ::protobuf::UnknownFields, + pub cached_size: ::protobuf::CachedSize, +} + +impl<'a> ::std::default::Default for &'a CopyFileRequest { + fn default() -> &'a CopyFileRequest { + ::default_instance() + } +} + +impl CopyFileRequest { + pub fn new() -> CopyFileRequest { + ::std::default::Default::default() + } + + // string path = 1; + + + pub fn get_path(&self) -> &str { + &self.path + } + pub fn clear_path(&mut self) { + self.path.clear(); + } + + // Param is passed by value, moved + pub fn set_path(&mut self, v: ::std::string::String) { + self.path = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_path(&mut self) -> &mut ::std::string::String { + &mut self.path + } + + // Take field + pub fn take_path(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.path, ::std::string::String::new()) + } + + // int64 file_size = 2; + + + pub fn get_file_size(&self) -> i64 { + self.file_size + } + pub fn clear_file_size(&mut self) { + self.file_size = 0; + } + + // Param is passed by value, moved + pub fn set_file_size(&mut self, v: i64) { + self.file_size = v; + } + + // uint32 file_mode = 3; + + + pub fn get_file_mode(&self) -> u32 { + self.file_mode + } + pub fn clear_file_mode(&mut self) { + self.file_mode = 0; + } + + // Param is passed by value, moved + pub fn set_file_mode(&mut self, v: u32) { + self.file_mode = v; + } + + // uint32 dir_mode = 4; + + + pub fn get_dir_mode(&self) -> u32 { + self.dir_mode + } + pub fn clear_dir_mode(&mut self) { + self.dir_mode = 0; + } + + // Param is passed by value, moved + pub fn set_dir_mode(&mut self, v: u32) { + self.dir_mode = v; + } + + // int32 uid = 5; + + + pub fn get_uid(&self) -> i32 { + self.uid + } + pub fn clear_uid(&mut self) { + self.uid = 0; + } + + // Param is passed by value, moved + pub fn set_uid(&mut self, v: i32) { + self.uid = v; + } + + // int32 gid = 6; + + + pub fn get_gid(&self) -> i32 { + self.gid + } + pub fn clear_gid(&mut self) { + self.gid = 0; + } + + // Param is passed by value, moved + pub fn set_gid(&mut self, v: i32) { + self.gid = v; + } + + // int64 offset = 7; + + + pub fn get_offset(&self) -> i64 { + self.offset + } + pub fn clear_offset(&mut self) { + self.offset = 0; + } + + // Param is passed by value, moved + pub fn set_offset(&mut self, v: i64) { + self.offset = v; + } + + // bytes data = 8; + + + pub fn get_data(&self) -> &[u8] { + &self.data + } + pub fn clear_data(&mut self) { + self.data.clear(); + } + + // Param is passed by value, moved + pub fn set_data(&mut self, v: ::std::vec::Vec) { + self.data = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_data(&mut self) -> &mut ::std::vec::Vec { + &mut self.data + } + + // Take field + pub fn take_data(&mut self) -> ::std::vec::Vec { + ::std::mem::replace(&mut self.data, ::std::vec::Vec::new()) + } +} + +impl ::protobuf::Message for CopyFileRequest { + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.path)?; + }, + 2 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_int64()?; + self.file_size = tmp; + }, + 3 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint32()?; + self.file_mode = tmp; + }, + 4 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint32()?; + self.dir_mode = tmp; + }, + 5 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_int32()?; + self.uid = tmp; + }, + 6 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_int32()?; + self.gid = tmp; + }, + 7 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_int64()?; + self.offset = tmp; + }, + 8 => { + ::protobuf::rt::read_singular_proto3_bytes_into(wire_type, is, &mut self.data)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if !self.path.is_empty() { + my_size += ::protobuf::rt::string_size(1, &self.path); + } + if self.file_size != 0 { + my_size += ::protobuf::rt::value_size(2, self.file_size, ::protobuf::wire_format::WireTypeVarint); + } + if self.file_mode != 0 { + my_size += ::protobuf::rt::value_size(3, self.file_mode, ::protobuf::wire_format::WireTypeVarint); + } + if self.dir_mode != 0 { + my_size += ::protobuf::rt::value_size(4, self.dir_mode, ::protobuf::wire_format::WireTypeVarint); + } + if self.uid != 0 { + my_size += ::protobuf::rt::value_size(5, self.uid, ::protobuf::wire_format::WireTypeVarint); + } + if self.gid != 0 { + my_size += ::protobuf::rt::value_size(6, self.gid, ::protobuf::wire_format::WireTypeVarint); + } + if self.offset != 0 { + my_size += ::protobuf::rt::value_size(7, self.offset, ::protobuf::wire_format::WireTypeVarint); + } + if !self.data.is_empty() { + my_size += ::protobuf::rt::bytes_size(8, &self.data); + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if !self.path.is_empty() { + os.write_string(1, &self.path)?; + } + if self.file_size != 0 { + os.write_int64(2, self.file_size)?; + } + if self.file_mode != 0 { + os.write_uint32(3, self.file_mode)?; + } + if self.dir_mode != 0 { + os.write_uint32(4, self.dir_mode)?; + } + if self.uid != 0 { + os.write_int32(5, self.uid)?; + } + if self.gid != 0 { + os.write_int32(6, self.gid)?; + } + if self.offset != 0 { + os.write_int64(7, self.offset)?; + } + if !self.data.is_empty() { + os.write_bytes(8, &self.data)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> CopyFileRequest { + CopyFileRequest::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "path", + |m: &CopyFileRequest| { &m.path }, + |m: &mut CopyFileRequest| { &mut m.path }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeInt64>( + "file_size", + |m: &CopyFileRequest| { &m.file_size }, + |m: &mut CopyFileRequest| { &mut m.file_size }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint32>( + "file_mode", + |m: &CopyFileRequest| { &m.file_mode }, + |m: &mut CopyFileRequest| { &mut m.file_mode }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint32>( + "dir_mode", + |m: &CopyFileRequest| { &m.dir_mode }, + |m: &mut CopyFileRequest| { &mut m.dir_mode }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeInt32>( + "uid", + |m: &CopyFileRequest| { &m.uid }, + |m: &mut CopyFileRequest| { &mut m.uid }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeInt32>( + "gid", + |m: &CopyFileRequest| { &m.gid }, + |m: &mut CopyFileRequest| { &mut m.gid }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeInt64>( + "offset", + |m: &CopyFileRequest| { &m.offset }, + |m: &mut CopyFileRequest| { &mut m.offset }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( + "data", + |m: &CopyFileRequest| { &m.data }, + |m: &mut CopyFileRequest| { &mut m.data }, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "CopyFileRequest", + fields, + file_descriptor_proto() + ) + }) + } + } + + fn default_instance() -> &'static CopyFileRequest { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const CopyFileRequest, + }; + unsafe { + instance.get(CopyFileRequest::new) + } + } +} + +impl ::protobuf::Clear for CopyFileRequest { + fn clear(&mut self) { + self.path.clear(); + self.file_size = 0; + self.file_mode = 0; + self.dir_mode = 0; + self.uid = 0; + self.gid = 0; + self.offset = 0; + self.data.clear(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for CopyFileRequest { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for CopyFileRequest { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct StartTracingRequest { + // special fields + pub unknown_fields: ::protobuf::UnknownFields, + pub cached_size: ::protobuf::CachedSize, +} + +impl<'a> ::std::default::Default for &'a StartTracingRequest { + fn default() -> &'a StartTracingRequest { + ::default_instance() + } +} + +impl StartTracingRequest { + pub fn new() -> StartTracingRequest { + ::std::default::Default::default() + } +} + +impl ::protobuf::Message for StartTracingRequest { + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> StartTracingRequest { + StartTracingRequest::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let fields = ::std::vec::Vec::new(); + ::protobuf::reflect::MessageDescriptor::new::( + "StartTracingRequest", + fields, + file_descriptor_proto() + ) + }) + } + } + + fn default_instance() -> &'static StartTracingRequest { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const StartTracingRequest, + }; + unsafe { + instance.get(StartTracingRequest::new) + } + } +} + +impl ::protobuf::Clear for StartTracingRequest { + fn clear(&mut self) { + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for StartTracingRequest { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for StartTracingRequest { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct StopTracingRequest { + // special fields + pub unknown_fields: ::protobuf::UnknownFields, + pub cached_size: ::protobuf::CachedSize, +} + +impl<'a> ::std::default::Default for &'a StopTracingRequest { + fn default() -> &'a StopTracingRequest { + ::default_instance() + } +} + +impl StopTracingRequest { + pub fn new() -> StopTracingRequest { + ::std::default::Default::default() + } +} + +impl ::protobuf::Message for StopTracingRequest { + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> StopTracingRequest { + StopTracingRequest::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let fields = ::std::vec::Vec::new(); + ::protobuf::reflect::MessageDescriptor::new::( + "StopTracingRequest", + fields, + file_descriptor_proto() + ) + }) + } + } + + fn default_instance() -> &'static StopTracingRequest { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const StopTracingRequest, + }; + unsafe { + instance.get(StopTracingRequest::new) + } + } +} + +impl ::protobuf::Clear for StopTracingRequest { + fn clear(&mut self) { + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for StopTracingRequest { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for StopTracingRequest { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +static file_descriptor_proto_data: &'static [u8] = b"\ + \n\x0bagent.proto\x12\x04grpc\x1a\toci.proto\x1a6github.com/kata-contain\ + ers/agent/pkg/types/types.proto\x1a\x1bgoogle/protobuf/empty.proto\"\x9d\ + \x02\n\x16CreateContainerRequest\x12!\n\x0ccontainer_id\x18\x01\x20\x01(\ + \tR\x0bcontainerId\x12\x17\n\x07exec_id\x18\x02\x20\x01(\tR\x06execId\ + \x121\n\x0bstring_user\x18\x03\x20\x01(\x0b2\x10.grpc.StringUserR\nstrin\ + gUser\x12&\n\x07devices\x18\x04\x20\x03(\x0b2\x0c.grpc.DeviceR\x07device\ + s\x12)\n\x08storages\x18\x05\x20\x03(\x0b2\r.grpc.StorageR\x08storages\ + \x12\x1c\n\x03OCI\x18\x06\x20\x01(\x0b2\n.grpc.SpecR\x03OCI\x12#\n\rsand\ + box_pidns\x18\x07\x20\x01(\x08R\x0csandboxPidns\":\n\x15StartContainerRe\ + quest\x12!\n\x0ccontainer_id\x18\x01\x20\x01(\tR\x0bcontainerId\"U\n\x16\ + RemoveContainerRequest\x12!\n\x0ccontainer_id\x18\x01\x20\x01(\tR\x0bcon\ + tainerId\x12\x18\n\x07timeout\x18\x02\x20\x01(\rR\x07timeout\"\xac\x01\n\ + \x12ExecProcessRequest\x12!\n\x0ccontainer_id\x18\x01\x20\x01(\tR\x0bcon\ + tainerId\x12\x17\n\x07exec_id\x18\x02\x20\x01(\tR\x06execId\x121\n\x0bst\ + ring_user\x18\x03\x20\x01(\x0b2\x10.grpc.StringUserR\nstringUser\x12'\n\ + \x07process\x18\x04\x20\x01(\x0b2\r.grpc.ProcessR\x07process\"j\n\x14Sig\ + nalProcessRequest\x12!\n\x0ccontainer_id\x18\x01\x20\x01(\tR\x0bcontaine\ + rId\x12\x17\n\x07exec_id\x18\x02\x20\x01(\tR\x06execId\x12\x16\n\x06sign\ + al\x18\x03\x20\x01(\rR\x06signal\"P\n\x12WaitProcessRequest\x12!\n\x0cco\ + ntainer_id\x18\x01\x20\x01(\tR\x0bcontainerId\x12\x17\n\x07exec_id\x18\ + \x02\x20\x01(\tR\x06execId\"-\n\x13WaitProcessResponse\x12\x16\n\x06stat\ + us\x18\x01\x20\x01(\x05R\x06status\"e\n\x14ListProcessesRequest\x12!\n\ + \x0ccontainer_id\x18\x01\x20\x01(\tR\x0bcontainerId\x12\x16\n\x06format\ + \x18\x02\x20\x01(\tR\x06format\x12\x12\n\x04args\x18\x03\x20\x03(\tR\x04\ + args\":\n\x15ListProcessesResponse\x12!\n\x0cprocess_list\x18\x01\x20\ + \x01(\x0cR\x0bprocessList\"o\n\x16UpdateContainerRequest\x12!\n\x0cconta\ + iner_id\x18\x01\x20\x01(\tR\x0bcontainerId\x122\n\tresources\x18\x02\x20\ + \x01(\x0b2\x14.grpc.LinuxResourcesR\tresources\":\n\x15StatsContainerReq\ + uest\x12!\n\x0ccontainer_id\x18\x01\x20\x01(\tR\x0bcontainerId\":\n\x15P\ + auseContainerRequest\x12!\n\x0ccontainer_id\x18\x01\x20\x01(\tR\x0bconta\ + inerId\";\n\x16ResumeContainerRequest\x12!\n\x0ccontainer_id\x18\x01\x20\ + \x01(\tR\x0bcontainerId\"\xaa\x01\n\x08CpuUsage\x12\x1f\n\x0btotal_usage\ + \x18\x01\x20\x01(\x04R\ntotalUsage\x12!\n\x0cpercpu_usage\x18\x02\x20\ + \x03(\x04R\x0bpercpuUsage\x12.\n\x13usage_in_kernelmode\x18\x03\x20\x01(\ + \x04R\x11usageInKernelmode\x12*\n\x11usage_in_usermode\x18\x04\x20\x01(\ + \x04R\x0fusageInUsermode\"~\n\x0eThrottlingData\x12\x18\n\x07periods\x18\ + \x01\x20\x01(\x04R\x07periods\x12+\n\x11throttled_periods\x18\x02\x20\ + \x01(\x04R\x10throttledPeriods\x12%\n\x0ethrottled_time\x18\x03\x20\x01(\ + \x04R\rthrottledTime\"v\n\x08CpuStats\x12+\n\tcpu_usage\x18\x01\x20\x01(\ + \x0b2\x0e.grpc.CpuUsageR\x08cpuUsage\x12=\n\x0fthrottling_data\x18\x02\ + \x20\x01(\x0b2\x14.grpc.ThrottlingDataR\x0ethrottlingData\";\n\tPidsStat\ + s\x12\x18\n\x07current\x18\x01\x20\x01(\x04R\x07current\x12\x14\n\x05lim\ + it\x18\x02\x20\x01(\x04R\x05limit\"o\n\nMemoryData\x12\x14\n\x05usage\ + \x18\x01\x20\x01(\x04R\x05usage\x12\x1b\n\tmax_usage\x18\x02\x20\x01(\ + \x04R\x08maxUsage\x12\x18\n\x07failcnt\x18\x03\x20\x01(\x04R\x07failcnt\ + \x12\x14\n\x05limit\x18\x04\x20\x01(\x04R\x05limit\"\xc4\x02\n\x0bMemory\ + Stats\x12\x14\n\x05cache\x18\x01\x20\x01(\x04R\x05cache\x12&\n\x05usage\ + \x18\x02\x20\x01(\x0b2\x10.grpc.MemoryDataR\x05usage\x12/\n\nswap_usage\ + \x18\x03\x20\x01(\x0b2\x10.grpc.MemoryDataR\tswapUsage\x123\n\x0ckernel_\ + usage\x18\x04\x20\x01(\x0b2\x10.grpc.MemoryDataR\x0bkernelUsage\x12#\n\r\ + use_hierarchy\x18\x05\x20\x01(\x08R\x0cuseHierarchy\x122\n\x05stats\x18\ + \x06\x20\x03(\x0b2\x1c.grpc.MemoryStats.StatsEntryR\x05stats\x1a8\n\nSta\ + tsEntry\x12\x10\n\x03key\x18\x01\x20\x01(\tR\x03key\x12\x14\n\x05value\ + \x18\x02\x20\x01(\x04R\x05value:\x028\x01\"c\n\x0fBlkioStatsEntry\x12\ + \x14\n\x05major\x18\x01\x20\x01(\x04R\x05major\x12\x14\n\x05minor\x18\ + \x02\x20\x01(\x04R\x05minor\x12\x0e\n\x02op\x18\x03\x20\x01(\tR\x02op\ + \x12\x14\n\x05value\x18\x04\x20\x01(\x04R\x05value\"\xde\x04\n\nBlkioSta\ + ts\x12R\n\x1aio_service_bytes_recursive\x18\x01\x20\x03(\x0b2\x15.grpc.B\ + lkioStatsEntryR\x17ioServiceBytesRecursive\x12I\n\x15io_serviced_recursi\ + ve\x18\x02\x20\x03(\x0b2\x15.grpc.BlkioStatsEntryR\x13ioServicedRecursiv\ + e\x12E\n\x13io_queued_recursive\x18\x03\x20\x03(\x0b2\x15.grpc.BlkioStat\ + sEntryR\x11ioQueuedRecursive\x12P\n\x19io_service_time_recursive\x18\x04\ + \x20\x03(\x0b2\x15.grpc.BlkioStatsEntryR\x16ioServiceTimeRecursive\x12J\ + \n\x16io_wait_time_recursive\x18\x05\x20\x03(\x0b2\x15.grpc.BlkioStatsEn\ + tryR\x13ioWaitTimeRecursive\x12E\n\x13io_merged_recursive\x18\x06\x20\ + \x03(\x0b2\x15.grpc.BlkioStatsEntryR\x11ioMergedRecursive\x12A\n\x11io_t\ + ime_recursive\x18\x07\x20\x03(\x0b2\x15.grpc.BlkioStatsEntryR\x0fioTimeR\ + ecursive\x12B\n\x11sectors_recursive\x18\x08\x20\x03(\x0b2\x15.grpc.Blki\ + oStatsEntryR\x10sectorsRecursive\"[\n\x0cHugetlbStats\x12\x14\n\x05usage\ + \x18\x01\x20\x01(\x04R\x05usage\x12\x1b\n\tmax_usage\x18\x02\x20\x01(\ + \x04R\x08maxUsage\x12\x18\n\x07failcnt\x18\x03\x20\x01(\x04R\x07failcnt\ + \"\xf2\x02\n\x0bCgroupStats\x12+\n\tcpu_stats\x18\x01\x20\x01(\x0b2\x0e.\ + grpc.CpuStatsR\x08cpuStats\x124\n\x0cmemory_stats\x18\x02\x20\x01(\x0b2\ + \x11.grpc.MemoryStatsR\x0bmemoryStats\x12.\n\npids_stats\x18\x03\x20\x01\ + (\x0b2\x0f.grpc.PidsStatsR\tpidsStats\x121\n\x0bblkio_stats\x18\x04\x20\ + \x01(\x0b2\x10.grpc.BlkioStatsR\nblkioStats\x12H\n\rhugetlb_stats\x18\ + \x05\x20\x03(\x0b2#.grpc.CgroupStats.HugetlbStatsEntryR\x0chugetlbStats\ + \x1aS\n\x11HugetlbStatsEntry\x12\x10\n\x03key\x18\x01\x20\x01(\tR\x03key\ + \x12(\n\x05value\x18\x02\x20\x01(\x0b2\x12.grpc.HugetlbStatsR\x05value:\ + \x028\x01\"\x8e\x02\n\x0cNetworkStats\x12\x12\n\x04name\x18\x01\x20\x01(\ + \tR\x04name\x12\x19\n\x08rx_bytes\x18\x02\x20\x01(\x04R\x07rxBytes\x12\ + \x1d\n\nrx_packets\x18\x03\x20\x01(\x04R\trxPackets\x12\x1b\n\trx_errors\ + \x18\x04\x20\x01(\x04R\x08rxErrors\x12\x1d\n\nrx_dropped\x18\x05\x20\x01\ + (\x04R\trxDropped\x12\x19\n\x08tx_bytes\x18\x06\x20\x01(\x04R\x07txBytes\ + \x12\x1d\n\ntx_packets\x18\x07\x20\x01(\x04R\ttxPackets\x12\x1b\n\ttx_er\ + rors\x18\x08\x20\x01(\x04R\x08txErrors\x12\x1d\n\ntx_dropped\x18\t\x20\ + \x01(\x04R\ttxDropped\"\x87\x01\n\x16StatsContainerResponse\x124\n\x0ccg\ + roup_stats\x18\x01\x20\x01(\x0b2\x11.grpc.CgroupStatsR\x0bcgroupStats\ + \x127\n\rnetwork_stats\x18\x02\x20\x03(\x0b2\x12.grpc.NetworkStatsR\x0cn\ + etworkStats\"d\n\x12WriteStreamRequest\x12!\n\x0ccontainer_id\x18\x01\ + \x20\x01(\tR\x0bcontainerId\x12\x17\n\x07exec_id\x18\x02\x20\x01(\tR\x06\ + execId\x12\x12\n\x04data\x18\x03\x20\x01(\x0cR\x04data\"'\n\x13WriteStre\ + amResponse\x12\x10\n\x03len\x18\x01\x20\x01(\rR\x03len\"a\n\x11ReadStrea\ + mRequest\x12!\n\x0ccontainer_id\x18\x01\x20\x01(\tR\x0bcontainerId\x12\ + \x17\n\x07exec_id\x18\x02\x20\x01(\tR\x06execId\x12\x10\n\x03len\x18\x03\ + \x20\x01(\rR\x03len\"(\n\x12ReadStreamResponse\x12\x12\n\x04data\x18\x01\ + \x20\x01(\x0cR\x04data\"O\n\x11CloseStdinRequest\x12!\n\x0ccontainer_id\ + \x18\x01\x20\x01(\tR\x0bcontainerId\x12\x17\n\x07exec_id\x18\x02\x20\x01\ + (\tR\x06execId\"{\n\x13TtyWinResizeRequest\x12!\n\x0ccontainer_id\x18\ + \x01\x20\x01(\tR\x0bcontainerId\x12\x17\n\x07exec_id\x18\x02\x20\x01(\tR\ + \x06execId\x12\x10\n\x03row\x18\x03\x20\x01(\rR\x03row\x12\x16\n\x06colu\ + mn\x18\x04\x20\x01(\rR\x06column\"\xdb\x01\n\x14CreateSandboxRequest\x12\ + \x1a\n\x08hostname\x18\x01\x20\x01(\tR\x08hostname\x12\x10\n\x03dns\x18\ + \x02\x20\x03(\tR\x03dns\x12)\n\x08storages\x18\x03\x20\x03(\x0b2\r.grpc.\ + StorageR\x08storages\x12#\n\rsandbox_pidns\x18\x04\x20\x01(\x08R\x0csand\ + boxPidns\x12\x1d\n\nsandbox_id\x18\x05\x20\x01(\tR\tsandboxId\x12&\n\x0f\ + guest_hook_path\x18\x06\x20\x01(\tR\rguestHookPath\"\x17\n\x15DestroySan\ + dboxRequest\">\n\nInterfaces\x120\n\nInterfaces\x18\x01\x20\x03(\x0b2\ + \x10.types.InterfaceR\nInterfaces\".\n\x06Routes\x12$\n\x06Routes\x18\ + \x01\x20\x03(\x0b2\x0c.types.RouteR\x06Routes\"H\n\x16UpdateInterfaceReq\ + uest\x12.\n\tinterface\x18\x01\x20\x01(\x0b2\x10.types.InterfaceR\tinter\ + face\";\n\x13UpdateRoutesRequest\x12$\n\x06routes\x18\x01\x20\x01(\x0b2\ + \x0c.grpc.RoutesR\x06routes\"\x17\n\x15ListInterfacesRequest\"\x13\n\x11\ + ListRoutesRequest\"]\n\x13OnlineCPUMemRequest\x12\x12\n\x04wait\x18\x01\ + \x20\x01(\x08R\x04wait\x12\x17\n\x07nb_cpus\x18\x02\x20\x01(\rR\x06nbCpu\ + s\x12\x19\n\x08cpu_only\x18\x03\x20\x01(\x08R\x07cpuOnly\",\n\x16ReseedR\ + andomDevRequest\x12\x12\n\x04data\x18\x02\x20\x01(\x0cR\x04data\"\xc8\ + \x01\n\x0cAgentDetails\x12\x18\n\x07version\x18\x01\x20\x01(\tR\x07versi\ + on\x12\x1f\n\x0binit_daemon\x18\x02\x20\x01(\x08R\ninitDaemon\x12'\n\x0f\ + device_handlers\x18\x03\x20\x03(\tR\x0edeviceHandlers\x12)\n\x10storage_\ + handlers\x18\x04\x20\x03(\tR\x0fstorageHandlers\x12)\n\x10supports_secco\ + mp\x18\x05\x20\x01(\x08R\x0fsupportsSeccomp\"g\n\x13GuestDetailsRequest\ + \x12$\n\x0emem_block_size\x18\x01\x20\x01(\x08R\x0cmemBlockSize\x12*\n\ + \x11mem_hotplug_probe\x18\x02\x20\x01(\x08R\x0fmemHotplugProbe\"\xbb\x01\ + \n\x14GuestDetailsResponse\x12/\n\x14mem_block_size_bytes\x18\x01\x20\ + \x01(\x04R\x11memBlockSizeBytes\x127\n\ragent_details\x18\x02\x20\x01(\ + \x0b2\x12.grpc.AgentDetailsR\x0cagentDetails\x129\n\x19support_mem_hotpl\ + ug_probe\x18\x03\x20\x01(\x08R\x16supportMemHotplugProbe\"L\n\x18MemHotp\ + lugByProbeRequest\x120\n\x13memHotplugProbeAddr\x18\x01\x20\x03(\x04R\ + \x13memHotplugProbeAddr\"?\n\x17SetGuestDateTimeRequest\x12\x10\n\x03Sec\ + \x18\x01\x20\x01(\x03R\x03Sec\x12\x12\n\x04Usec\x18\x02\x20\x01(\x03R\ + \x04Usec\"\xb3\x01\n\x07Storage\x12\x16\n\x06driver\x18\x01\x20\x01(\tR\ + \x06driver\x12%\n\x0edriver_options\x18\x02\x20\x03(\tR\rdriverOptions\ + \x12\x16\n\x06source\x18\x03\x20\x01(\tR\x06source\x12\x16\n\x06fstype\ + \x18\x04\x20\x01(\tR\x06fstype\x12\x18\n\x07options\x18\x05\x20\x03(\tR\ + \x07options\x12\x1f\n\x0bmount_point\x18\x06\x20\x01(\tR\nmountPoint\"\ + \x86\x01\n\x06Device\x12\x0e\n\x02id\x18\x01\x20\x01(\tR\x02id\x12\x12\n\ + \x04type\x18\x02\x20\x01(\tR\x04type\x12\x17\n\x07vm_path\x18\x03\x20\ + \x01(\tR\x06vmPath\x12%\n\x0econtainer_path\x18\x04\x20\x01(\tR\rcontain\ + erPath\x12\x18\n\x07options\x18\x05\x20\x03(\tR\x07options\"X\n\nStringU\ + ser\x12\x10\n\x03uid\x18\x01\x20\x01(\tR\x03uid\x12\x10\n\x03gid\x18\x02\ + \x20\x01(\tR\x03gid\x12&\n\x0eadditionalGids\x18\x03\x20\x03(\tR\x0eaddi\ + tionalGids\"\xca\x01\n\x0fCopyFileRequest\x12\x12\n\x04path\x18\x01\x20\ + \x01(\tR\x04path\x12\x1b\n\tfile_size\x18\x02\x20\x01(\x03R\x08fileSize\ + \x12\x1b\n\tfile_mode\x18\x03\x20\x01(\rR\x08fileMode\x12\x19\n\x08dir_m\ + ode\x18\x04\x20\x01(\rR\x07dirMode\x12\x10\n\x03uid\x18\x05\x20\x01(\x05\ + R\x03uid\x12\x10\n\x03gid\x18\x06\x20\x01(\x05R\x03gid\x12\x16\n\x06offs\ + et\x18\x07\x20\x01(\x03R\x06offset\x12\x12\n\x04data\x18\x08\x20\x01(\ + \x0cR\x04data\"\x15\n\x13StartTracingRequest\"\x14\n\x12StopTracingReque\ + st2\x93\x10\n\x0cAgentService\x12G\n\x0fCreateContainer\x12\x1c.grpc.Cre\ + ateContainerRequest\x1a\x16.google.protobuf.Empty\x12E\n\x0eStartContain\ + er\x12\x1b.grpc.StartContainerRequest\x1a\x16.google.protobuf.Empty\x12G\ + \n\x0fRemoveContainer\x12\x1c.grpc.RemoveContainerRequest\x1a\x16.google\ + .protobuf.Empty\x12?\n\x0bExecProcess\x12\x18.grpc.ExecProcessRequest\ + \x1a\x16.google.protobuf.Empty\x12C\n\rSignalProcess\x12\x1a.grpc.Signal\ + ProcessRequest\x1a\x16.google.protobuf.Empty\x12B\n\x0bWaitProcess\x12\ + \x18.grpc.WaitProcessRequest\x1a\x19.grpc.WaitProcessResponse\x12H\n\rLi\ + stProcesses\x12\x1a.grpc.ListProcessesRequest\x1a\x1b.grpc.ListProcesses\ + Response\x12G\n\x0fUpdateContainer\x12\x1c.grpc.UpdateContainerRequest\ + \x1a\x16.google.protobuf.Empty\x12K\n\x0eStatsContainer\x12\x1b.grpc.Sta\ + tsContainerRequest\x1a\x1c.grpc.StatsContainerResponse\x12E\n\x0ePauseCo\ + ntainer\x12\x1b.grpc.PauseContainerRequest\x1a\x16.google.protobuf.Empty\ + \x12G\n\x0fResumeContainer\x12\x1c.grpc.ResumeContainerRequest\x1a\x16.g\ + oogle.protobuf.Empty\x12A\n\nWriteStdin\x12\x18.grpc.WriteStreamRequest\ + \x1a\x19.grpc.WriteStreamResponse\x12?\n\nReadStdout\x12\x17.grpc.ReadSt\ + reamRequest\x1a\x18.grpc.ReadStreamResponse\x12?\n\nReadStderr\x12\x17.g\ + rpc.ReadStreamRequest\x1a\x18.grpc.ReadStreamResponse\x12=\n\nCloseStdin\ + \x12\x17.grpc.CloseStdinRequest\x1a\x16.google.protobuf.Empty\x12A\n\x0c\ + TtyWinResize\x12\x19.grpc.TtyWinResizeRequest\x1a\x16.google.protobuf.Em\ + pty\x12A\n\x0fUpdateInterface\x12\x1c.grpc.UpdateInterfaceRequest\x1a\ + \x10.types.Interface\x127\n\x0cUpdateRoutes\x12\x19.grpc.UpdateRoutesReq\ + uest\x1a\x0c.grpc.Routes\x12?\n\x0eListInterfaces\x12\x1b.grpc.ListInter\ + facesRequest\x1a\x10.grpc.Interfaces\x123\n\nListRoutes\x12\x17.grpc.Lis\ + tRoutesRequest\x1a\x0c.grpc.Routes\x12A\n\x0cStartTracing\x12\x19.grpc.S\ + tartTracingRequest\x1a\x16.google.protobuf.Empty\x12?\n\x0bStopTracing\ + \x12\x18.grpc.StopTracingRequest\x1a\x16.google.protobuf.Empty\x12C\n\rC\ + reateSandbox\x12\x1a.grpc.CreateSandboxRequest\x1a\x16.google.protobuf.E\ + mpty\x12E\n\x0eDestroySandbox\x12\x1b.grpc.DestroySandboxRequest\x1a\x16\ + .google.protobuf.Empty\x12A\n\x0cOnlineCPUMem\x12\x19.grpc.OnlineCPUMemR\ + equest\x1a\x16.google.protobuf.Empty\x12G\n\x0fReseedRandomDev\x12\x1c.g\ + rpc.ReseedRandomDevRequest\x1a\x16.google.protobuf.Empty\x12H\n\x0fGetGu\ + estDetails\x12\x19.grpc.GuestDetailsRequest\x1a\x1a.grpc.GuestDetailsRes\ + ponse\x12K\n\x11MemHotplugByProbe\x12\x1e.grpc.MemHotplugByProbeRequest\ + \x1a\x16.google.protobuf.Empty\x12I\n\x10SetGuestDateTime\x12\x1d.grpc.S\ + etGuestDateTimeRequest\x1a\x16.google.protobuf.Empty\x129\n\x08CopyFile\ + \x12\x15.grpc.CopyFileRequest\x1a\x16.google.protobuf.EmptyJ\xe1\xa4\x01\ + \n\x07\x12\x05\x06\0\xe5\x03\x01\nO\n\x01\x0c\x12\x03\x06\0\x122E\n\x20C\ + opyright\x202017\x20HyperHQ\x20Inc.\n\n\x20SPDX-License-Identifier:\x20A\ + pache-2.0\n\n\n\x08\n\x01\x02\x12\x03\x08\0\r\n\t\n\x02\x03\0\x12\x03\n\ + \0\x13\n\t\n\x02\x03\x01\x12\x03\x0b\0@\n\t\n\x02\x03\x02\x12\x03\x0c\0%\ + \n\x16\n\x02\x06\0\x12\x04\x0f\0>\x01\x1a\n\x20unstable\n\n\n\n\x03\x06\ + \0\x01\x12\x03\x0f\x08\x14\n\x18\n\x04\x06\0\x02\0\x12\x03\x11\x08T\x1a\ + \x0b\x20execution\n\n\x0c\n\x05\x06\0\x02\0\x01\x12\x03\x11\x0c\x1b\n\ + \x0c\n\x05\x06\0\x02\0\x02\x12\x03\x11\x1c2\n\x0c\n\x05\x06\0\x02\0\x03\ + \x12\x03\x11=R\n\x0b\n\x04\x06\0\x02\x01\x12\x03\x12\x08R\n\x0c\n\x05\ + \x06\0\x02\x01\x01\x12\x03\x12\x0c\x1a\n\x0c\n\x05\x06\0\x02\x01\x02\x12\ + \x03\x12\x1b0\n\x0c\n\x05\x06\0\x02\x01\x03\x12\x03\x12;P\n\x9c\x03\n\ + \x04\x06\0\x02\x02\x12\x03\x1a\x08T\x1a\x8e\x03\x20RemoveContainer\x20wi\ + ll\x20tear\x20down\x20an\x20existing\x20container\x20by\x20forcibly\x20t\ + erminating\n\x20all\x20processes\x20running\x20inside\x20that\x20contain\ + er\x20and\x20releasing\x20all\x20internal\n\x20resources\x20associated\ + \x20with\x20it.\n\x20RemoveContainer\x20will\x20wait\x20for\x20all\x20pr\ + ocesses\x20termination\x20before\x20returning.\n\x20If\x20any\x20process\ + \x20can\x20not\x20be\x20killed\x20or\x20if\x20it\x20can\x20not\x20be\x20\ + killed\x20after\n\x20the\x20RemoveContainerRequest\x20timeout,\x20Remove\ + Container\x20will\x20return\x20an\x20error.\n\n\x0c\n\x05\x06\0\x02\x02\ + \x01\x12\x03\x1a\x0c\x1b\n\x0c\n\x05\x06\0\x02\x02\x02\x12\x03\x1a\x1c2\ + \n\x0c\n\x05\x06\0\x02\x02\x03\x12\x03\x1a=R\n\x0b\n\x04\x06\0\x02\x03\ + \x12\x03\x1b\x08L\n\x0c\n\x05\x06\0\x02\x03\x01\x12\x03\x1b\x0c\x17\n\ + \x0c\n\x05\x06\0\x02\x03\x02\x12\x03\x1b\x18*\n\x0c\n\x05\x06\0\x02\x03\ + \x03\x12\x03\x1b5J\n\x0b\n\x04\x06\0\x02\x04\x12\x03\x1c\x08P\n\x0c\n\ + \x05\x06\0\x02\x04\x01\x12\x03\x1c\x0c\x19\n\x0c\n\x05\x06\0\x02\x04\x02\ + \x12\x03\x1c\x1a.\n\x0c\n\x05\x06\0\x02\x04\x03\x12\x03\x1c9N\n*\n\x04\ + \x06\0\x02\x05\x12\x03\x1d\x08J\"\x1d\x20wait\x20&\x20reap\x20like\x20wa\ + itpid(2)\n\n\x0c\n\x05\x06\0\x02\x05\x01\x12\x03\x1d\x0c\x17\n\x0c\n\x05\ + \x06\0\x02\x05\x02\x12\x03\x1d\x18*\n\x0c\n\x05\x06\0\x02\x05\x03\x12\ + \x03\x1d5H\n\x0b\n\x04\x06\0\x02\x06\x12\x03\x1e\x08P\n\x0c\n\x05\x06\0\ + \x02\x06\x01\x12\x03\x1e\x0c\x19\n\x0c\n\x05\x06\0\x02\x06\x02\x12\x03\ + \x1e\x1a.\n\x0c\n\x05\x06\0\x02\x06\x03\x12\x03\x1e9N\n\x0b\n\x04\x06\0\ + \x02\x07\x12\x03\x1f\x08T\n\x0c\n\x05\x06\0\x02\x07\x01\x12\x03\x1f\x0c\ + \x1b\n\x0c\n\x05\x06\0\x02\x07\x02\x12\x03\x1f\x1c2\n\x0c\n\x05\x06\0\ + \x02\x07\x03\x12\x03\x1f=R\n\x0b\n\x04\x06\0\x02\x08\x12\x03\x20\x08S\n\ + \x0c\n\x05\x06\0\x02\x08\x01\x12\x03\x20\x0c\x1a\n\x0c\n\x05\x06\0\x02\ + \x08\x02\x12\x03\x20\x1b0\n\x0c\n\x05\x06\0\x02\x08\x03\x12\x03\x20;Q\n\ + \x0b\n\x04\x06\0\x02\t\x12\x03!\x08R\n\x0c\n\x05\x06\0\x02\t\x01\x12\x03\ + !\x0c\x1a\n\x0c\n\x05\x06\0\x02\t\x02\x12\x03!\x1b0\n\x0c\n\x05\x06\0\ + \x02\t\x03\x12\x03!;P\n\x0b\n\x04\x06\0\x02\n\x12\x03\"\x08T\n\x0c\n\x05\ + \x06\0\x02\n\x01\x12\x03\"\x0c\x1b\n\x0c\n\x05\x06\0\x02\n\x02\x12\x03\"\ + \x1c2\n\x0c\n\x05\x06\0\x02\n\x03\x12\x03\"=R\n\x14\n\x04\x06\0\x02\x0b\ + \x12\x03%\x08I\x1a\x07\x20stdio\n\n\x0c\n\x05\x06\0\x02\x0b\x01\x12\x03%\ + \x0c\x16\n\x0c\n\x05\x06\0\x02\x0b\x02\x12\x03%\x17)\n\x0c\n\x05\x06\0\ + \x02\x0b\x03\x12\x03%4G\n\x0b\n\x04\x06\0\x02\x0c\x12\x03&\x08G\n\x0c\n\ + \x05\x06\0\x02\x0c\x01\x12\x03&\x0c\x16\n\x0c\n\x05\x06\0\x02\x0c\x02\ + \x12\x03&\x17(\n\x0c\n\x05\x06\0\x02\x0c\x03\x12\x03&3E\n\x0b\n\x04\x06\ + \0\x02\r\x12\x03'\x08G\n\x0c\n\x05\x06\0\x02\r\x01\x12\x03'\x0c\x16\n\ + \x0c\n\x05\x06\0\x02\r\x02\x12\x03'\x17(\n\x0c\n\x05\x06\0\x02\r\x03\x12\ + \x03'3E\n\x0b\n\x04\x06\0\x02\x0e\x12\x03(\x08J\n\x0c\n\x05\x06\0\x02\ + \x0e\x01\x12\x03(\x0c\x16\n\x0c\n\x05\x06\0\x02\x0e\x02\x12\x03(\x17(\n\ + \x0c\n\x05\x06\0\x02\x0e\x03\x12\x03(3H\n\x0b\n\x04\x06\0\x02\x0f\x12\ + \x03)\x08N\n\x0c\n\x05\x06\0\x02\x0f\x01\x12\x03)\x0c\x18\n\x0c\n\x05\ + \x06\0\x02\x0f\x02\x12\x03)\x19,\n\x0c\n\x05\x06\0\x02\x0f\x03\x12\x03)7\ + L\n\x19\n\x04\x06\0\x02\x10\x12\x03,\x08N\x1a\x0c\x20networking\n\n\x0c\ + \n\x05\x06\0\x02\x10\x01\x12\x03,\x0c\x1b\n\x0c\n\x05\x06\0\x02\x10\x02\ + \x12\x03,\x1c2\n\x0c\n\x05\x06\0\x02\x10\x03\x12\x03,=L\n\x0b\n\x04\x06\ + \0\x02\x11\x12\x03-\x08?\n\x0c\n\x05\x06\0\x02\x11\x01\x12\x03-\x0c\x18\ + \n\x0c\n\x05\x06\0\x02\x11\x02\x12\x03-\x19,\n\x0c\n\x05\x06\0\x02\x11\ + \x03\x12\x03-7=\n\x0b\n\x04\x06\0\x02\x12\x12\x03.\x08F\n\x0c\n\x05\x06\ + \0\x02\x12\x01\x12\x03.\x0c\x1a\n\x0c\n\x05\x06\0\x02\x12\x02\x12\x03.\ + \x1b0\n\x0c\n\x05\x06\0\x02\x12\x03\x12\x03.:D\n\x0b\n\x04\x06\0\x02\x13\ + \x12\x03/\x08;\n\x0c\n\x05\x06\0\x02\x13\x01\x12\x03/\x0c\x16\n\x0c\n\ + \x05\x06\0\x02\x13\x02\x12\x03/\x17(\n\x0c\n\x05\x06\0\x02\x13\x03\x12\ + \x03/39\n\x16\n\x04\x06\0\x02\x14\x12\x032\x08N\x1a\t\x20tracing\n\n\x0c\ + \n\x05\x06\0\x02\x14\x01\x12\x032\x0c\x18\n\x0c\n\x05\x06\0\x02\x14\x02\ + \x12\x032\x19,\n\x0c\n\x05\x06\0\x02\x14\x03\x12\x0327L\n\x0b\n\x04\x06\ + \0\x02\x15\x12\x033\x08L\n\x0c\n\x05\x06\0\x02\x15\x01\x12\x033\x0c\x17\ + \n\x0c\n\x05\x06\0\x02\x15\x02\x12\x033\x18*\n\x0c\n\x05\x06\0\x02\x15\ + \x03\x12\x0335J\nH\n\x04\x06\0\x02\x16\x12\x036\x08P\x1a;\x20misc\x20(TO\ + DO:\x20some\x20rpcs\x20can\x20be\x20replaced\x20by\x20hyperstart-exec)\n\ + \n\x0c\n\x05\x06\0\x02\x16\x01\x12\x036\x0c\x19\n\x0c\n\x05\x06\0\x02\ + \x16\x02\x12\x036\x1a.\n\x0c\n\x05\x06\0\x02\x16\x03\x12\x0369N\n\x0b\n\ + \x04\x06\0\x02\x17\x12\x037\x08R\n\x0c\n\x05\x06\0\x02\x17\x01\x12\x037\ + \x0c\x1a\n\x0c\n\x05\x06\0\x02\x17\x02\x12\x037\x1b0\n\x0c\n\x05\x06\0\ + \x02\x17\x03\x12\x037;P\n\x0b\n\x04\x06\0\x02\x18\x12\x038\x08N\n\x0c\n\ + \x05\x06\0\x02\x18\x01\x12\x038\x0c\x18\n\x0c\n\x05\x06\0\x02\x18\x02\ + \x12\x038\x19,\n\x0c\n\x05\x06\0\x02\x18\x03\x12\x0387L\n\x0b\n\x04\x06\ + \0\x02\x19\x12\x039\x08T\n\x0c\n\x05\x06\0\x02\x19\x01\x12\x039\x0c\x1b\ + \n\x0c\n\x05\x06\0\x02\x19\x02\x12\x039\x1c2\n\x0c\n\x05\x06\0\x02\x19\ + \x03\x12\x039=R\n\x0b\n\x04\x06\0\x02\x1a\x12\x03:\x08P\n\x0c\n\x05\x06\ + \0\x02\x1a\x01\x12\x03:\x0c\x1b\n\x0c\n\x05\x06\0\x02\x1a\x02\x12\x03:\ + \x1c/\n\x0c\n\x05\x06\0\x02\x1a\x03\x12\x03::N\n\x0b\n\x04\x06\0\x02\x1b\ + \x12\x03;\x08X\n\x0c\n\x05\x06\0\x02\x1b\x01\x12\x03;\x0c\x1d\n\x0c\n\ + \x05\x06\0\x02\x1b\x02\x12\x03;\x1e6\n\x0c\n\x05\x06\0\x02\x1b\x03\x12\ + \x03;AV\n\x0b\n\x04\x06\0\x02\x1c\x12\x03<\x08V\n\x0c\n\x05\x06\0\x02\ + \x1c\x01\x12\x03<\x0c\x1c\n\x0c\n\x05\x06\0\x02\x1c\x02\x12\x03<\x1d4\n\ + \x0c\n\x05\x06\0\x02\x1c\x03\x12\x03?\n\x0c\n\x04\x04\x14\x02\x01\x12\x04\xc7\x01\x08;\n\r\ + \n\x05\x04\x14\x02\x01\x04\x12\x04\xc7\x01\x08\x10\n\r\n\x05\x04\x14\x02\ + \x01\x06\x12\x04\xc7\x01\x11\x20\n\r\n\x05\x04\x14\x02\x01\x01\x12\x04\ + \xc7\x01!6\n\r\n\x05\x04\x14\x02\x01\x03\x12\x04\xc7\x019:\n\x0c\n\x04\ + \x04\x14\x02\x02\x12\x04\xc8\x01\x089\n\r\n\x05\x04\x14\x02\x02\x04\x12\ + \x04\xc8\x01\x08\x10\n\r\n\x05\x04\x14\x02\x02\x06\x12\x04\xc8\x01\x11\ + \x20\n\r\n\x05\x04\x14\x02\x02\x01\x12\x04\xc8\x01!4\n\r\n\x05\x04\x14\ + \x02\x02\x03\x12\x04\xc8\x0178\n\x0c\n\x04\x04\x14\x02\x03\x12\x04\xc9\ + \x01\x08?\n\r\n\x05\x04\x14\x02\x03\x04\x12\x04\xc9\x01\x08\x10\n\r\n\ + \x05\x04\x14\x02\x03\x06\x12\x04\xc9\x01\x11\x20\n\r\n\x05\x04\x14\x02\ + \x03\x01\x12\x04\xc9\x01!:\n\r\n\x05\x04\x14\x02\x03\x03\x12\x04\xc9\x01\ + =>\n\x0c\n\x04\x04\x14\x02\x04\x12\x04\xca\x01\x08<\n\r\n\x05\x04\x14\ + \x02\x04\x04\x12\x04\xca\x01\x08\x10\n\r\n\x05\x04\x14\x02\x04\x06\x12\ + \x04\xca\x01\x11\x20\n\r\n\x05\x04\x14\x02\x04\x01\x12\x04\xca\x01!7\n\r\ + \n\x05\x04\x14\x02\x04\x03\x12\x04\xca\x01:;\n\x0c\n\x04\x04\x14\x02\x05\ + \x12\x04\xcb\x01\x089\n\r\n\x05\x04\x14\x02\x05\x04\x12\x04\xcb\x01\x08\ + \x10\n\r\n\x05\x04\x14\x02\x05\x06\x12\x04\xcb\x01\x11\x20\n\r\n\x05\x04\ + \x14\x02\x05\x01\x12\x04\xcb\x01!4\n\r\n\x05\x04\x14\x02\x05\x03\x12\x04\ + \xcb\x0178\n\x0c\n\x04\x04\x14\x02\x06\x12\x04\xcc\x01\x087\n\r\n\x05\ + \x04\x14\x02\x06\x04\x12\x04\xcc\x01\x08\x10\n\r\n\x05\x04\x14\x02\x06\ + \x06\x12\x04\xcc\x01\x11\x20\n\r\n\x05\x04\x14\x02\x06\x01\x12\x04\xcc\ + \x01!2\n\r\n\x05\x04\x14\x02\x06\x03\x12\x04\xcc\x0156\n\x0c\n\x04\x04\ + \x14\x02\x07\x12\x04\xcd\x01\x087\n\r\n\x05\x04\x14\x02\x07\x04\x12\x04\ + \xcd\x01\x08\x10\n\r\n\x05\x04\x14\x02\x07\x06\x12\x04\xcd\x01\x11\x20\n\ + \r\n\x05\x04\x14\x02\x07\x01\x12\x04\xcd\x01!2\n\r\n\x05\x04\x14\x02\x07\ + \x03\x12\x04\xcd\x0156\n\x0c\n\x02\x04\x15\x12\x06\xd0\x01\0\xd4\x01\x01\ + \n\x0b\n\x03\x04\x15\x01\x12\x04\xd0\x01\x08\x14\n\x0c\n\x04\x04\x15\x02\ + \0\x12\x04\xd1\x01\x08\x19\n\x0f\n\x05\x04\x15\x02\0\x04\x12\x06\xd1\x01\ + \x08\xd0\x01\x16\n\r\n\x05\x04\x15\x02\0\x05\x12\x04\xd1\x01\x08\x0e\n\r\ + \n\x05\x04\x15\x02\0\x01\x12\x04\xd1\x01\x0f\x14\n\r\n\x05\x04\x15\x02\0\ + \x03\x12\x04\xd1\x01\x17\x18\n\x0c\n\x04\x04\x15\x02\x01\x12\x04\xd2\x01\ + \x08\x1d\n\x0f\n\x05\x04\x15\x02\x01\x04\x12\x06\xd2\x01\x08\xd1\x01\x19\ + \n\r\n\x05\x04\x15\x02\x01\x05\x12\x04\xd2\x01\x08\x0e\n\r\n\x05\x04\x15\ + \x02\x01\x01\x12\x04\xd2\x01\x0f\x18\n\r\n\x05\x04\x15\x02\x01\x03\x12\ + \x04\xd2\x01\x1b\x1c\n\x0c\n\x04\x04\x15\x02\x02\x12\x04\xd3\x01\x08\x1b\ + \n\x0f\n\x05\x04\x15\x02\x02\x04\x12\x06\xd3\x01\x08\xd2\x01\x1d\n\r\n\ + \x05\x04\x15\x02\x02\x05\x12\x04\xd3\x01\x08\x0e\n\r\n\x05\x04\x15\x02\ + \x02\x01\x12\x04\xd3\x01\x0f\x16\n\r\n\x05\x04\x15\x02\x02\x03\x12\x04\ + \xd3\x01\x19\x1a\n\x0c\n\x02\x04\x16\x12\x06\xd6\x01\0\xdd\x01\x01\n\x0b\ + \n\x03\x04\x16\x01\x12\x04\xd6\x01\x08\x13\n\x0c\n\x04\x04\x16\x02\0\x12\ + \x04\xd7\x01\x04\x1b\n\x0f\n\x05\x04\x16\x02\0\x04\x12\x06\xd7\x01\x04\ + \xd6\x01\x15\n\r\n\x05\x04\x16\x02\0\x06\x12\x04\xd7\x01\x04\x0c\n\r\n\ + \x05\x04\x16\x02\0\x01\x12\x04\xd7\x01\r\x16\n\r\n\x05\x04\x16\x02\0\x03\ + \x12\x04\xd7\x01\x19\x1a\n\x0c\n\x04\x04\x16\x02\x01\x12\x04\xd8\x01\x04\ + \"\n\x0f\n\x05\x04\x16\x02\x01\x04\x12\x06\xd8\x01\x04\xd7\x01\x1b\n\r\n\ + \x05\x04\x16\x02\x01\x06\x12\x04\xd8\x01\x04\x0f\n\r\n\x05\x04\x16\x02\ + \x01\x01\x12\x04\xd8\x01\x10\x1c\n\r\n\x05\x04\x16\x02\x01\x03\x12\x04\ + \xd8\x01\x20!\n\x0c\n\x04\x04\x16\x02\x02\x12\x04\xd9\x01\x04\x1d\n\x0f\ + \n\x05\x04\x16\x02\x02\x04\x12\x06\xd9\x01\x04\xd8\x01\"\n\r\n\x05\x04\ + \x16\x02\x02\x06\x12\x04\xd9\x01\x04\r\n\r\n\x05\x04\x16\x02\x02\x01\x12\ + \x04\xd9\x01\x0e\x18\n\r\n\x05\x04\x16\x02\x02\x03\x12\x04\xd9\x01\x1b\ + \x1c\n\x0c\n\x04\x04\x16\x02\x03\x12\x04\xda\x01\x04\x1f\n\x0f\n\x05\x04\ + \x16\x02\x03\x04\x12\x06\xda\x01\x04\xd9\x01\x1d\n\r\n\x05\x04\x16\x02\ + \x03\x06\x12\x04\xda\x01\x04\x0e\n\r\n\x05\x04\x16\x02\x03\x01\x12\x04\ + \xda\x01\x0f\x1a\n\r\n\x05\x04\x16\x02\x03\x03\x12\x04\xda\x01\x1d\x1e\n\ + R\n\x04\x04\x16\x02\x04\x12\x04\xdb\x01\x040\"D\x20the\x20map\x20is\x20i\ + n\x20the\x20format\x20\"size\x20of\x20hugepage:\x20stats\x20of\x20the\ + \x20hugepage\"\n\n\x0f\n\x05\x04\x16\x02\x04\x04\x12\x06\xdb\x01\x04\xda\ + \x01\x1f\n\r\n\x05\x04\x16\x02\x04\x06\x12\x04\xdb\x01\x04\x1d\n\r\n\x05\ + \x04\x16\x02\x04\x01\x12\x04\xdb\x01\x1e+\n\r\n\x05\x04\x16\x02\x04\x03\ + \x12\x04\xdb\x01./\n\x0c\n\x02\x04\x17\x12\x06\xdf\x01\0\xe9\x01\x01\n\ + \x0b\n\x03\x04\x17\x01\x12\x04\xdf\x01\x08\x14\n\x0c\n\x04\x04\x17\x02\0\ + \x12\x04\xe0\x01\x08\x18\n\x0f\n\x05\x04\x17\x02\0\x04\x12\x06\xe0\x01\ + \x08\xdf\x01\x16\n\r\n\x05\x04\x17\x02\0\x05\x12\x04\xe0\x01\x08\x0e\n\r\ + \n\x05\x04\x17\x02\0\x01\x12\x04\xe0\x01\x0f\x13\n\r\n\x05\x04\x17\x02\0\ + \x03\x12\x04\xe0\x01\x16\x17\n\x0c\n\x04\x04\x17\x02\x01\x12\x04\xe1\x01\ + \x08\x1c\n\x0f\n\x05\x04\x17\x02\x01\x04\x12\x06\xe1\x01\x08\xe0\x01\x18\ + \n\r\n\x05\x04\x17\x02\x01\x05\x12\x04\xe1\x01\x08\x0e\n\r\n\x05\x04\x17\ + \x02\x01\x01\x12\x04\xe1\x01\x0f\x17\n\r\n\x05\x04\x17\x02\x01\x03\x12\ + \x04\xe1\x01\x1a\x1b\n\x0c\n\x04\x04\x17\x02\x02\x12\x04\xe2\x01\x08\x1e\ + \n\x0f\n\x05\x04\x17\x02\x02\x04\x12\x06\xe2\x01\x08\xe1\x01\x1c\n\r\n\ + \x05\x04\x17\x02\x02\x05\x12\x04\xe2\x01\x08\x0e\n\r\n\x05\x04\x17\x02\ + \x02\x01\x12\x04\xe2\x01\x0f\x19\n\r\n\x05\x04\x17\x02\x02\x03\x12\x04\ + \xe2\x01\x1c\x1d\n\x0c\n\x04\x04\x17\x02\x03\x12\x04\xe3\x01\x08\x1e\n\ + \x0f\n\x05\x04\x17\x02\x03\x04\x12\x06\xe3\x01\x08\xe2\x01\x1e\n\r\n\x05\ + \x04\x17\x02\x03\x05\x12\x04\xe3\x01\x08\x0e\n\r\n\x05\x04\x17\x02\x03\ + \x01\x12\x04\xe3\x01\x0f\x18\n\r\n\x05\x04\x17\x02\x03\x03\x12\x04\xe3\ + \x01\x1c\x1d\n\x0c\n\x04\x04\x17\x02\x04\x12\x04\xe4\x01\x08\x1e\n\x0f\n\ + \x05\x04\x17\x02\x04\x04\x12\x06\xe4\x01\x08\xe3\x01\x1e\n\r\n\x05\x04\ + \x17\x02\x04\x05\x12\x04\xe4\x01\x08\x0e\n\r\n\x05\x04\x17\x02\x04\x01\ + \x12\x04\xe4\x01\x0f\x19\n\r\n\x05\x04\x17\x02\x04\x03\x12\x04\xe4\x01\ + \x1c\x1d\n\x0c\n\x04\x04\x17\x02\x05\x12\x04\xe5\x01\x08\x1c\n\x0f\n\x05\ + \x04\x17\x02\x05\x04\x12\x06\xe5\x01\x08\xe4\x01\x1e\n\r\n\x05\x04\x17\ + \x02\x05\x05\x12\x04\xe5\x01\x08\x0e\n\r\n\x05\x04\x17\x02\x05\x01\x12\ + \x04\xe5\x01\x0f\x17\n\r\n\x05\x04\x17\x02\x05\x03\x12\x04\xe5\x01\x1a\ + \x1b\n\x0c\n\x04\x04\x17\x02\x06\x12\x04\xe6\x01\x08\x1e\n\x0f\n\x05\x04\ + \x17\x02\x06\x04\x12\x06\xe6\x01\x08\xe5\x01\x1c\n\r\n\x05\x04\x17\x02\ + \x06\x05\x12\x04\xe6\x01\x08\x0e\n\r\n\x05\x04\x17\x02\x06\x01\x12\x04\ + \xe6\x01\x0f\x19\n\r\n\x05\x04\x17\x02\x06\x03\x12\x04\xe6\x01\x1c\x1d\n\ + \x0c\n\x04\x04\x17\x02\x07\x12\x04\xe7\x01\x08\x1d\n\x0f\n\x05\x04\x17\ + \x02\x07\x04\x12\x06\xe7\x01\x08\xe6\x01\x1e\n\r\n\x05\x04\x17\x02\x07\ + \x05\x12\x04\xe7\x01\x08\x0e\n\r\n\x05\x04\x17\x02\x07\x01\x12\x04\xe7\ + \x01\x0f\x18\n\r\n\x05\x04\x17\x02\x07\x03\x12\x04\xe7\x01\x1b\x1c\n\x0c\ + \n\x04\x04\x17\x02\x08\x12\x04\xe8\x01\x08\x1e\n\x0f\n\x05\x04\x17\x02\ + \x08\x04\x12\x06\xe8\x01\x08\xe7\x01\x1d\n\r\n\x05\x04\x17\x02\x08\x05\ + \x12\x04\xe8\x01\x08\x0e\n\r\n\x05\x04\x17\x02\x08\x01\x12\x04\xe8\x01\ + \x0f\x19\n\r\n\x05\x04\x17\x02\x08\x03\x12\x04\xe8\x01\x1c\x1d\n\x0c\n\ + \x02\x04\x18\x12\x06\xeb\x01\0\xee\x01\x01\n\x0b\n\x03\x04\x18\x01\x12\ + \x04\xeb\x01\x08\x1e\n\x0c\n\x04\x04\x18\x02\0\x12\x04\xec\x01\x08%\n\ + \x0f\n\x05\x04\x18\x02\0\x04\x12\x06\xec\x01\x08\xeb\x01\x20\n\r\n\x05\ + \x04\x18\x02\0\x06\x12\x04\xec\x01\x08\x13\n\r\n\x05\x04\x18\x02\0\x01\ + \x12\x04\xec\x01\x14\x20\n\r\n\x05\x04\x18\x02\0\x03\x12\x04\xec\x01#$\n\ + \x0c\n\x04\x04\x18\x02\x01\x12\x04\xed\x01\x080\n\r\n\x05\x04\x18\x02\ + \x01\x04\x12\x04\xed\x01\x08\x10\n\r\n\x05\x04\x18\x02\x01\x06\x12\x04\ + \xed\x01\x11\x1d\n\r\n\x05\x04\x18\x02\x01\x01\x12\x04\xed\x01\x1e+\n\r\ + \n\x05\x04\x18\x02\x01\x03\x12\x04\xed\x01./\n\x0c\n\x02\x04\x19\x12\x06\ + \xf0\x01\0\xf4\x01\x01\n\x0b\n\x03\x04\x19\x01\x12\x04\xf0\x01\x08\x1a\n\ + \x0c\n\x04\x04\x19\x02\0\x12\x04\xf1\x01\x08\x20\n\x0f\n\x05\x04\x19\x02\ + \0\x04\x12\x06\xf1\x01\x08\xf0\x01\x1c\n\r\n\x05\x04\x19\x02\0\x05\x12\ + \x04\xf1\x01\x08\x0e\n\r\n\x05\x04\x19\x02\0\x01\x12\x04\xf1\x01\x0f\x1b\ + \n\r\n\x05\x04\x19\x02\0\x03\x12\x04\xf1\x01\x1e\x1f\n\x0c\n\x04\x04\x19\ + \x02\x01\x12\x04\xf2\x01\x08\x1b\n\x0f\n\x05\x04\x19\x02\x01\x04\x12\x06\ + \xf2\x01\x08\xf1\x01\x20\n\r\n\x05\x04\x19\x02\x01\x05\x12\x04\xf2\x01\ + \x08\x0e\n\r\n\x05\x04\x19\x02\x01\x01\x12\x04\xf2\x01\x0f\x16\n\r\n\x05\ + \x04\x19\x02\x01\x03\x12\x04\xf2\x01\x19\x1a\n\x0c\n\x04\x04\x19\x02\x02\ + \x12\x04\xf3\x01\x08\x17\n\x0f\n\x05\x04\x19\x02\x02\x04\x12\x06\xf3\x01\ + \x08\xf2\x01\x1b\n\r\n\x05\x04\x19\x02\x02\x05\x12\x04\xf3\x01\x08\r\n\r\ + \n\x05\x04\x19\x02\x02\x01\x12\x04\xf3\x01\x0e\x12\n\r\n\x05\x04\x19\x02\ + \x02\x03\x12\x04\xf3\x01\x15\x16\n\x0c\n\x02\x04\x1a\x12\x06\xf6\x01\0\ + \xf8\x01\x01\n\x0b\n\x03\x04\x1a\x01\x12\x04\xf6\x01\x08\x1b\n\x0c\n\x04\ + \x04\x1a\x02\0\x12\x04\xf7\x01\x08\x17\n\x0f\n\x05\x04\x1a\x02\0\x04\x12\ + \x06\xf7\x01\x08\xf6\x01\x1d\n\r\n\x05\x04\x1a\x02\0\x05\x12\x04\xf7\x01\ + \x08\x0e\n\r\n\x05\x04\x1a\x02\0\x01\x12\x04\xf7\x01\x0f\x12\n\r\n\x05\ + \x04\x1a\x02\0\x03\x12\x04\xf7\x01\x15\x16\n\x0c\n\x02\x04\x1b\x12\x06\ + \xfa\x01\0\xfe\x01\x01\n\x0b\n\x03\x04\x1b\x01\x12\x04\xfa\x01\x08\x19\n\ + \x0c\n\x04\x04\x1b\x02\0\x12\x04\xfb\x01\x08\x20\n\x0f\n\x05\x04\x1b\x02\ + \0\x04\x12\x06\xfb\x01\x08\xfa\x01\x1b\n\r\n\x05\x04\x1b\x02\0\x05\x12\ + \x04\xfb\x01\x08\x0e\n\r\n\x05\x04\x1b\x02\0\x01\x12\x04\xfb\x01\x0f\x1b\ + \n\r\n\x05\x04\x1b\x02\0\x03\x12\x04\xfb\x01\x1e\x1f\n\x0c\n\x04\x04\x1b\ + \x02\x01\x12\x04\xfc\x01\x08\x1b\n\x0f\n\x05\x04\x1b\x02\x01\x04\x12\x06\ + \xfc\x01\x08\xfb\x01\x20\n\r\n\x05\x04\x1b\x02\x01\x05\x12\x04\xfc\x01\ + \x08\x0e\n\r\n\x05\x04\x1b\x02\x01\x01\x12\x04\xfc\x01\x0f\x16\n\r\n\x05\ + \x04\x1b\x02\x01\x03\x12\x04\xfc\x01\x19\x1a\n\x0c\n\x04\x04\x1b\x02\x02\ + \x12\x04\xfd\x01\x08\x17\n\x0f\n\x05\x04\x1b\x02\x02\x04\x12\x06\xfd\x01\ + \x08\xfc\x01\x1b\n\r\n\x05\x04\x1b\x02\x02\x05\x12\x04\xfd\x01\x08\x0e\n\ + \r\n\x05\x04\x1b\x02\x02\x01\x12\x04\xfd\x01\x0f\x12\n\r\n\x05\x04\x1b\ + \x02\x02\x03\x12\x04\xfd\x01\x15\x16\n\x0c\n\x02\x04\x1c\x12\x06\x80\x02\ + \0\x82\x02\x01\n\x0b\n\x03\x04\x1c\x01\x12\x04\x80\x02\x08\x1a\n\x0c\n\ + \x04\x04\x1c\x02\0\x12\x04\x81\x02\x08\x17\n\x0f\n\x05\x04\x1c\x02\0\x04\ + \x12\x06\x81\x02\x08\x80\x02\x1c\n\r\n\x05\x04\x1c\x02\0\x05\x12\x04\x81\ + \x02\x08\r\n\r\n\x05\x04\x1c\x02\0\x01\x12\x04\x81\x02\x0e\x12\n\r\n\x05\ + \x04\x1c\x02\0\x03\x12\x04\x81\x02\x15\x16\n\x0c\n\x02\x04\x1d\x12\x06\ + \x84\x02\0\x87\x02\x01\n\x0b\n\x03\x04\x1d\x01\x12\x04\x84\x02\x08\x19\n\ + \x0c\n\x04\x04\x1d\x02\0\x12\x04\x85\x02\x08\x20\n\x0f\n\x05\x04\x1d\x02\ + \0\x04\x12\x06\x85\x02\x08\x84\x02\x1b\n\r\n\x05\x04\x1d\x02\0\x05\x12\ + \x04\x85\x02\x08\x0e\n\r\n\x05\x04\x1d\x02\0\x01\x12\x04\x85\x02\x0f\x1b\ + \n\r\n\x05\x04\x1d\x02\0\x03\x12\x04\x85\x02\x1e\x1f\n\x0c\n\x04\x04\x1d\ + \x02\x01\x12\x04\x86\x02\x08\x1b\n\x0f\n\x05\x04\x1d\x02\x01\x04\x12\x06\ + \x86\x02\x08\x85\x02\x20\n\r\n\x05\x04\x1d\x02\x01\x05\x12\x04\x86\x02\ + \x08\x0e\n\r\n\x05\x04\x1d\x02\x01\x01\x12\x04\x86\x02\x0f\x16\n\r\n\x05\ + \x04\x1d\x02\x01\x03\x12\x04\x86\x02\x19\x1a\n\x0c\n\x02\x04\x1e\x12\x06\ + \x89\x02\0\x8e\x02\x01\n\x0b\n\x03\x04\x1e\x01\x12\x04\x89\x02\x08\x1b\n\ + \x0c\n\x04\x04\x1e\x02\0\x12\x04\x8a\x02\x08\x20\n\x0f\n\x05\x04\x1e\x02\ + \0\x04\x12\x06\x8a\x02\x08\x89\x02\x1d\n\r\n\x05\x04\x1e\x02\0\x05\x12\ + \x04\x8a\x02\x08\x0e\n\r\n\x05\x04\x1e\x02\0\x01\x12\x04\x8a\x02\x0f\x1b\ + \n\r\n\x05\x04\x1e\x02\0\x03\x12\x04\x8a\x02\x1e\x1f\n\x0c\n\x04\x04\x1e\ + \x02\x01\x12\x04\x8b\x02\x08\x1b\n\x0f\n\x05\x04\x1e\x02\x01\x04\x12\x06\ + \x8b\x02\x08\x8a\x02\x20\n\r\n\x05\x04\x1e\x02\x01\x05\x12\x04\x8b\x02\ + \x08\x0e\n\r\n\x05\x04\x1e\x02\x01\x01\x12\x04\x8b\x02\x0f\x16\n\r\n\x05\ + \x04\x1e\x02\x01\x03\x12\x04\x8b\x02\x19\x1a\n\x0c\n\x04\x04\x1e\x02\x02\ + \x12\x04\x8c\x02\x08\x17\n\x0f\n\x05\x04\x1e\x02\x02\x04\x12\x06\x8c\x02\ + \x08\x8b\x02\x1b\n\r\n\x05\x04\x1e\x02\x02\x05\x12\x04\x8c\x02\x08\x0e\n\ + \r\n\x05\x04\x1e\x02\x02\x01\x12\x04\x8c\x02\x0f\x12\n\r\n\x05\x04\x1e\ + \x02\x02\x03\x12\x04\x8c\x02\x15\x16\n\x0c\n\x04\x04\x1e\x02\x03\x12\x04\ + \x8d\x02\x08\x1a\n\x0f\n\x05\x04\x1e\x02\x03\x04\x12\x06\x8d\x02\x08\x8c\ + \x02\x17\n\r\n\x05\x04\x1e\x02\x03\x05\x12\x04\x8d\x02\x08\x0e\n\r\n\x05\ + \x04\x1e\x02\x03\x01\x12\x04\x8d\x02\x0f\x15\n\r\n\x05\x04\x1e\x02\x03\ + \x03\x12\x04\x8d\x02\x18\x19\n\x0c\n\x02\x04\x1f\x12\x06\x90\x02\0\xa1\ + \x02\x01\n\x0b\n\x03\x04\x1f\x01\x12\x04\x90\x02\x08\x1c\n\x0c\n\x04\x04\ + \x1f\x02\0\x12\x04\x91\x02\x08\x1c\n\x0f\n\x05\x04\x1f\x02\0\x04\x12\x06\ + \x91\x02\x08\x90\x02\x1e\n\r\n\x05\x04\x1f\x02\0\x05\x12\x04\x91\x02\x08\ + \x0e\n\r\n\x05\x04\x1f\x02\0\x01\x12\x04\x91\x02\x0f\x17\n\r\n\x05\x04\ + \x1f\x02\0\x03\x12\x04\x91\x02\x1a\x1b\n\x0c\n\x04\x04\x1f\x02\x01\x12\ + \x04\x92\x02\x08\x20\n\r\n\x05\x04\x1f\x02\x01\x04\x12\x04\x92\x02\x08\ + \x10\n\r\n\x05\x04\x1f\x02\x01\x05\x12\x04\x92\x02\x11\x17\n\r\n\x05\x04\ + \x1f\x02\x01\x01\x12\x04\x92\x02\x18\x1b\n\r\n\x05\x04\x1f\x02\x01\x03\ + \x12\x04\x92\x02\x1e\x1f\n\x0c\n\x04\x04\x1f\x02\x02\x12\x04\x93\x02\x08\ + &\n\r\n\x05\x04\x1f\x02\x02\x04\x12\x04\x93\x02\x08\x10\n\r\n\x05\x04\ + \x1f\x02\x02\x06\x12\x04\x93\x02\x11\x18\n\r\n\x05\x04\x1f\x02\x02\x01\ + \x12\x04\x93\x02\x19!\n\r\n\x05\x04\x1f\x02\x02\x03\x12\x04\x93\x02$%\n\ + \xea\x01\n\x04\x04\x1f\x02\x03\x12\x04\x99\x02\x08\x1f\x1a\xdb\x01\x20Th\ + is\x20field\x20means\x20that\x20a\x20pause\x20process\x20needs\x20to\x20\ + be\x20created\x20by\x20the\n\x20agent.\x20This\x20pid\x20namespace\x20of\ + \x20the\x20pause\x20process\x20will\x20be\x20treated\x20as\n\x20a\x20sha\ + red\x20pid\x20namespace.\x20All\x20containers\x20created\x20will\x20join\ + \x20this\x20shared\n\x20pid\x20namespace.\n\n\x0f\n\x05\x04\x1f\x02\x03\ + \x04\x12\x06\x99\x02\x08\x93\x02&\n\r\n\x05\x04\x1f\x02\x03\x05\x12\x04\ + \x99\x02\x08\x0c\n\r\n\x05\x04\x1f\x02\x03\x01\x12\x04\x99\x02\r\x1a\n\r\ + \n\x05\x04\x1f\x02\x03\x03\x12\x04\x99\x02\x1d\x1e\n\xc5\x01\n\x04\x04\ + \x1f\x02\x04\x12\x04\x9d\x02\x08\x1e\x1a\xb6\x01\x20SandboxId\x20identif\ + ies\x20which\x20sandbox\x20is\x20using\x20the\x20agent.\x20We\x20allow\ + \x20only\n\x20one\x20sandbox\x20per\x20agent\x20and\x20implicitly\x20req\ + uire\x20that\x20CreateSandbox\x20is\n\x20called\x20before\x20other\x20sa\ + ndbox/network\x20calls.\n\n\x0f\n\x05\x04\x1f\x02\x04\x04\x12\x06\x9d\ + \x02\x08\x99\x02\x1f\n\r\n\x05\x04\x1f\x02\x04\x05\x12\x04\x9d\x02\x08\ + \x0e\n\r\n\x05\x04\x1f\x02\x04\x01\x12\x04\x9d\x02\x0f\x19\n\r\n\x05\x04\ + \x1f\x02\x04\x03\x12\x04\x9d\x02\x1c\x1d\n\x98\x01\n\x04\x04\x1f\x02\x05\ + \x12\x04\xa0\x02\x08#\x1a\x89\x01\x20This\x20field,\x20if\x20non-empty,\ + \x20designates\x20an\x20absolute\x20path\x20to\x20a\x20directory\n\x20th\ + at\x20the\x20agent\x20will\x20search\x20for\x20OCI\x20hooks\x20to\x20run\ + \x20within\x20the\x20guest.\n\n\x0f\n\x05\x04\x1f\x02\x05\x04\x12\x06\ + \xa0\x02\x08\x9d\x02\x1e\n\r\n\x05\x04\x1f\x02\x05\x05\x12\x04\xa0\x02\ + \x08\x0e\n\r\n\x05\x04\x1f\x02\x05\x01\x12\x04\xa0\x02\x0f\x1e\n\r\n\x05\ + \x04\x1f\x02\x05\x03\x12\x04\xa0\x02!\"\n\x0c\n\x02\x04\x20\x12\x06\xa3\ + \x02\0\xa4\x02\x01\n\x0b\n\x03\x04\x20\x01\x12\x04\xa3\x02\x08\x1d\n\x0c\ + \n\x02\x04!\x12\x06\xa6\x02\0\xa8\x02\x01\n\x0b\n\x03\x04!\x01\x12\x04\ + \xa6\x02\x08\x12\n\x0c\n\x04\x04!\x02\0\x12\x04\xa7\x02\x080\n\r\n\x05\ + \x04!\x02\0\x04\x12\x04\xa7\x02\x08\x10\n\r\n\x05\x04!\x02\0\x06\x12\x04\ + \xa7\x02\x11\x20\n\r\n\x05\x04!\x02\0\x01\x12\x04\xa7\x02!+\n\r\n\x05\ + \x04!\x02\0\x03\x12\x04\xa7\x02./\n\x0c\n\x02\x04\"\x12\x06\xaa\x02\0\ + \xac\x02\x01\n\x0b\n\x03\x04\"\x01\x12\x04\xaa\x02\x08\x0e\n\x0c\n\x04\ + \x04\"\x02\0\x12\x04\xab\x02\x08(\n\r\n\x05\x04\"\x02\0\x04\x12\x04\xab\ + \x02\x08\x10\n\r\n\x05\x04\"\x02\0\x06\x12\x04\xab\x02\x11\x1c\n\r\n\x05\ + \x04\"\x02\0\x01\x12\x04\xab\x02\x1d#\n\r\n\x05\x04\"\x02\0\x03\x12\x04\ + \xab\x02&'\n\x0c\n\x02\x04#\x12\x06\xae\x02\0\xb0\x02\x01\n\x0b\n\x03\ + \x04#\x01\x12\x04\xae\x02\x08\x1e\n\x0c\n\x04\x04#\x02\0\x12\x04\xaf\x02\ + \x08&\n\x0f\n\x05\x04#\x02\0\x04\x12\x06\xaf\x02\x08\xae\x02\x20\n\r\n\ + \x05\x04#\x02\0\x06\x12\x04\xaf\x02\x08\x17\n\r\n\x05\x04#\x02\0\x01\x12\ + \x04\xaf\x02\x18!\n\r\n\x05\x04#\x02\0\x03\x12\x04\xaf\x02$%\n\x0c\n\x02\ + \x04$\x12\x06\xb2\x02\0\xb4\x02\x01\n\x0b\n\x03\x04$\x01\x12\x04\xb2\x02\ + \x08\x1b\n\x0c\n\x04\x04$\x02\0\x12\x04\xb3\x02\x08\x1a\n\x0f\n\x05\x04$\ + \x02\0\x04\x12\x06\xb3\x02\x08\xb2\x02\x1d\n\r\n\x05\x04$\x02\0\x06\x12\ + \x04\xb3\x02\x08\x0e\n\r\n\x05\x04$\x02\0\x01\x12\x04\xb3\x02\x0f\x15\n\ + \r\n\x05\x04$\x02\0\x03\x12\x04\xb3\x02\x18\x19\n\x0c\n\x02\x04%\x12\x06\ + \xb6\x02\0\xb7\x02\x01\n\x0b\n\x03\x04%\x01\x12\x04\xb6\x02\x08\x1d\n\ + \x0c\n\x02\x04&\x12\x06\xb9\x02\0\xba\x02\x01\n\x0b\n\x03\x04&\x01\x12\ + \x04\xb9\x02\x08\x19\n\x0c\n\x02\x04'\x12\x06\xbc\x02\0\xc7\x02\x01\n\ + \x0b\n\x03\x04'\x01\x12\x04\xbc\x02\x08\x1b\n\xf6\x01\n\x04\x04'\x02\0\ + \x12\x04\xc0\x02\x08\x16\x1a\xe7\x01\x20Wait\x20specifies\x20if\x20the\ + \x20caller\x20waits\x20for\x20the\x20agent\x20to\x20online\x20all\x20res\ + ources.\n\x20If\x20true\x20the\x20agent\x20returns\x20once\x20all\x20res\ + ources\x20have\x20been\x20connected,\x20otherwise\x20all\n\x20resources\ + \x20are\x20connected\x20asynchronously\x20and\x20the\x20agent\x20returns\ + \x20immediately.\n\n\x0f\n\x05\x04'\x02\0\x04\x12\x06\xc0\x02\x08\xbc\ + \x02\x1d\n\r\n\x05\x04'\x02\0\x05\x12\x04\xc0\x02\x08\x0c\n\r\n\x05\x04'\ + \x02\0\x01\x12\x04\xc0\x02\r\x11\n\r\n\x05\x04'\x02\0\x03\x12\x04\xc0\ + \x02\x14\x15\n`\n\x04\x04'\x02\x01\x12\x04\xc3\x02\x08\x1b\x1aR\x20NbCpu\ + s\x20specifies\x20the\x20number\x20of\x20CPUs\x20that\x20were\x20added\ + \x20and\x20the\x20agent\x20has\x20to\x20online.\n\n\x0f\n\x05\x04'\x02\ + \x01\x04\x12\x06\xc3\x02\x08\xc0\x02\x16\n\r\n\x05\x04'\x02\x01\x05\x12\ + \x04\xc3\x02\x08\x0e\n\r\n\x05\x04'\x02\x01\x01\x12\x04\xc3\x02\x0f\x16\ + \n\r\n\x05\x04'\x02\x01\x03\x12\x04\xc3\x02\x19\x1a\nA\n\x04\x04'\x02\ + \x02\x12\x04\xc6\x02\x08\x1a\x1a3\x20CpuOnly\x20specifies\x20whether\x20\ + only\x20online\x20CPU\x20or\x20not.\n\n\x0f\n\x05\x04'\x02\x02\x04\x12\ + \x06\xc6\x02\x08\xc3\x02\x1b\n\r\n\x05\x04'\x02\x02\x05\x12\x04\xc6\x02\ + \x08\x0c\n\r\n\x05\x04'\x02\x02\x01\x12\x04\xc6\x02\r\x15\n\r\n\x05\x04'\ + \x02\x02\x03\x12\x04\xc6\x02\x18\x19\n\x0c\n\x02\x04(\x12\x06\xc9\x02\0\ + \xcc\x02\x01\n\x0b\n\x03\x04(\x01\x12\x04\xc9\x02\x08\x1e\nM\n\x04\x04(\ + \x02\0\x12\x04\xcb\x02\x08\x17\x1a?\x20Data\x20specifies\x20the\x20rando\ + m\x20data\x20used\x20to\x20reseed\x20the\x20guest\x20crng.\n\n\x0f\n\x05\ + \x04(\x02\0\x04\x12\x06\xcb\x02\x08\xc9\x02\x20\n\r\n\x05\x04(\x02\0\x05\ + \x12\x04\xcb\x02\x08\r\n\r\n\x05\x04(\x02\0\x01\x12\x04\xcb\x02\x0e\x12\ + \n\r\n\x05\x04(\x02\0\x03\x12\x04\xcb\x02\x15\x16\nX\n\x02\x04)\x12\x06\ + \xcf\x02\0\xdf\x02\x01\x1aJ\x20AgentDetails\x20provides\x20information\ + \x20to\x20the\x20client\x20about\x20the\x20running\x20agent.\n\n\x0b\n\ + \x03\x04)\x01\x12\x04\xcf\x02\x08\x14\nC\n\x04\x04)\x02\0\x12\x04\xd1\ + \x02\x08\x1b\x1a5\x20Semantic\x20version\x20of\x20agent\x20(see\x20https\ + ://semver.org).\n\n\x0f\n\x05\x04)\x02\0\x04\x12\x06\xd1\x02\x08\xcf\x02\ + \x16\n\r\n\x05\x04)\x02\0\x05\x12\x04\xd1\x02\x08\x0e\n\r\n\x05\x04)\x02\ + \0\x01\x12\x04\xd1\x02\x0f\x16\n\r\n\x05\x04)\x02\0\x03\x12\x04\xd1\x02\ + \x19\x1a\n5\n\x04\x04)\x02\x01\x12\x04\xd4\x02\x08\x1d\x1a'\x20Set\x20if\ + \x20the\x20agent\x20is\x20running\x20as\x20PID\x201.\n\n\x0f\n\x05\x04)\ + \x02\x01\x04\x12\x06\xd4\x02\x08\xd1\x02\x1b\n\r\n\x05\x04)\x02\x01\x05\ + \x12\x04\xd4\x02\x08\x0c\n\r\n\x05\x04)\x02\x01\x01\x12\x04\xd4\x02\r\ + \x18\n\r\n\x05\x04)\x02\x01\x03\x12\x04\xd4\x02\x1b\x1c\n2\n\x04\x04)\ + \x02\x02\x12\x04\xd7\x02\x08,\x1a$\x20List\x20of\x20available\x20device\ + \x20handlers.\n\n\r\n\x05\x04)\x02\x02\x04\x12\x04\xd7\x02\x08\x10\n\r\n\ + \x05\x04)\x02\x02\x05\x12\x04\xd7\x02\x11\x17\n\r\n\x05\x04)\x02\x02\x01\ + \x12\x04\xd7\x02\x18'\n\r\n\x05\x04)\x02\x02\x03\x12\x04\xd7\x02*+\n3\n\ + \x04\x04)\x02\x03\x12\x04\xda\x02\x08-\x1a%\x20List\x20of\x20available\ + \x20storage\x20handlers.\n\n\r\n\x05\x04)\x02\x03\x04\x12\x04\xda\x02\ + \x08\x10\n\r\n\x05\x04)\x02\x03\x05\x12\x04\xda\x02\x11\x17\n\r\n\x05\ + \x04)\x02\x03\x01\x12\x04\xda\x02\x18(\n\r\n\x05\x04)\x02\x03\x03\x12\ + \x04\xda\x02+,\np\n\x04\x04)\x02\x04\x12\x04\xde\x02\x08\"\x1ab\x20Set\ + \x20only\x20if\x20the\x20agent\x20is\x20built\x20with\x20seccomp\x20supp\ + ort\x20and\x20the\x20guest\n\x20environment\x20supports\x20seccomp.\n\n\ + \x0f\n\x05\x04)\x02\x04\x04\x12\x06\xde\x02\x08\xda\x02-\n\r\n\x05\x04)\ + \x02\x04\x05\x12\x04\xde\x02\x08\x0c\n\r\n\x05\x04)\x02\x04\x01\x12\x04\ + \xde\x02\r\x1d\n\r\n\x05\x04)\x02\x04\x03\x12\x04\xde\x02\x20!\n\x0c\n\ + \x02\x04*\x12\x06\xe1\x02\0\xeb\x02\x01\n\x0b\n\x03\x04*\x01\x12\x04\xe1\ + \x02\x08\x1b\n\xd5\x01\n\x04\x04*\x02\0\x12\x04\xe5\x02\x08\x20\x1a\xc6\ + \x01\x20MemBlockSize\x20asks\x20server\x20to\x20return\x20the\x20system\ + \x20memory\x20block\x20size\x20that\x20can\x20be\x20used\n\x20for\x20mem\ + ory\x20hotplug\x20alignment.\x20Typically\x20the\x20server\x20returns\ + \x20what's\x20in\n\x20/sys/devices/system/memory/block_size_bytes.\n\n\ + \x0f\n\x05\x04*\x02\0\x04\x12\x06\xe5\x02\x08\xe1\x02\x1d\n\r\n\x05\x04*\ + \x02\0\x05\x12\x04\xe5\x02\x08\x0c\n\r\n\x05\x04*\x02\0\x01\x12\x04\xe5\ + \x02\r\x1b\n\r\n\x05\x04*\x02\0\x03\x12\x04\xe5\x02\x1e\x1f\n\xd1\x01\n\ + \x04\x04*\x02\x01\x12\x04\xea\x02\x08#\x1a\xc2\x01\x20MemoryHotplugProbe\ + \x20asks\x20server\x20to\x20return\x20whether\x20guest\x20kernel\x20supp\ + orts\x20memory\x20hotplug\n\x20via\x20probeinterface.\x20Typically\x20th\ + e\x20server\x20will\x20check\x20if\x20the\x20path\n\x20/sys/devices/syst\ + em/memory/probe\x20exists.\n\n\x0f\n\x05\x04*\x02\x01\x04\x12\x06\xea\ + \x02\x08\xe5\x02\x20\n\r\n\x05\x04*\x02\x01\x05\x12\x04\xea\x02\x08\x0c\ + \n\r\n\x05\x04*\x02\x01\x01\x12\x04\xea\x02\r\x1e\n\r\n\x05\x04*\x02\x01\ + \x03\x12\x04\xea\x02!\"\n\x0c\n\x02\x04+\x12\x06\xed\x02\0\xf4\x02\x01\n\ + \x0b\n\x03\x04+\x01\x12\x04\xed\x02\x08\x1c\nP\n\x04\x04+\x02\0\x12\x04\ + \xef\x02\x08(\x1aB\x20MemBlockSizeBytes\x20returns\x20the\x20system\x20m\ + emory\x20block\x20size\x20in\x20bytes.\n\n\x0f\n\x05\x04+\x02\0\x04\x12\ + \x06\xef\x02\x08\xed\x02\x1e\n\r\n\x05\x04+\x02\0\x05\x12\x04\xef\x02\ + \x08\x0e\n\r\n\x05\x04+\x02\0\x01\x12\x04\xef\x02\x0f#\n\r\n\x05\x04+\ + \x02\0\x03\x12\x04\xef\x02&'\n\x0c\n\x04\x04+\x02\x01\x12\x04\xf1\x02\ + \x08'\n\x0f\n\x05\x04+\x02\x01\x04\x12\x06\xf1\x02\x08\xef\x02(\n\r\n\ + \x05\x04+\x02\x01\x06\x12\x04\xf1\x02\x08\x14\n\r\n\x05\x04+\x02\x01\x01\ + \x12\x04\xf1\x02\x15\"\n\r\n\x05\x04+\x02\x01\x03\x12\x04\xf1\x02%&\n\ + \x0c\n\x04\x04+\x02\x02\x12\x04\xf3\x02\x08+\n\x0f\n\x05\x04+\x02\x02\ + \x04\x12\x06\xf3\x02\x08\xf1\x02'\n\r\n\x05\x04+\x02\x02\x05\x12\x04\xf3\ + \x02\x08\x0c\n\r\n\x05\x04+\x02\x02\x01\x12\x04\xf3\x02\r&\n\r\n\x05\x04\ + +\x02\x02\x03\x12\x04\xf3\x02)*\n\x0c\n\x02\x04,\x12\x06\xf6\x02\0\xfa\ + \x02\x01\n\x0b\n\x03\x04,\x01\x12\x04\xf6\x02\x08\x20\n\xb2\x01\n\x04\ + \x04,\x02\0\x12\x04\xf9\x02\x080\x1a\xa3\x01\x20server\x20needs\x20to\ + \x20send\x20the\x20value\x20of\x20memHotplugProbeAddr\x20into\x20file\ + \x20/sys/devices/system/memory/probe,\n\x20in\x20order\x20to\x20notify\ + \x20the\x20guest\x20kernel\x20about\x20hot-add\x20memory\x20event\n\n\r\ + \n\x05\x04,\x02\0\x04\x12\x04\xf9\x02\x08\x10\n\r\n\x05\x04,\x02\0\x05\ + \x12\x04\xf9\x02\x11\x17\n\r\n\x05\x04,\x02\0\x01\x12\x04\xf9\x02\x18+\n\ + \r\n\x05\x04,\x02\0\x03\x12\x04\xf9\x02./\n\x0c\n\x02\x04-\x12\x06\xfc\ + \x02\0\x81\x03\x01\n\x0b\n\x03\x04-\x01\x12\x04\xfc\x02\x08\x1f\n/\n\x04\ + \x04-\x02\0\x12\x04\xfe\x02\x08\x16\x1a!\x20Sec\x20the\x20second\x20sinc\ + e\x20the\x20Epoch.\n\n\x0f\n\x05\x04-\x02\0\x04\x12\x06\xfe\x02\x08\xfc\ + \x02!\n\r\n\x05\x04-\x02\0\x05\x12\x04\xfe\x02\x08\r\n\r\n\x05\x04-\x02\ + \0\x01\x12\x04\xfe\x02\x0e\x11\n\r\n\x05\x04-\x02\0\x03\x12\x04\xfe\x02\ + \x14\x15\nF\n\x04\x04-\x02\x01\x12\x04\x80\x03\x08\x17\x1a8\x20Usec\x20t\ + he\x20microseconds\x20portion\x20of\x20time\x20since\x20the\x20Epoch.\n\ + \n\x0f\n\x05\x04-\x02\x01\x04\x12\x06\x80\x03\x08\xfe\x02\x16\n\r\n\x05\ + \x04-\x02\x01\x05\x12\x04\x80\x03\x08\r\n\r\n\x05\x04-\x02\x01\x01\x12\ + \x04\x80\x03\x0e\x12\n\r\n\x05\x04-\x02\x01\x03\x12\x04\x80\x03\x15\x16\ + \n\xa3\x01\n\x02\x04.\x12\x06\x85\x03\0\x9f\x03\x01\x1a\x94\x01\x20Stora\ + ge\x20represents\x20both\x20the\x20rootfs\x20of\x20the\x20container,\x20\ + and\x20any\x20volume\x20that\n\x20could\x20have\x20been\x20defined\x20th\ + rough\x20the\x20Mount\x20list\x20of\x20the\x20OCI\x20specification.\n\n\ + \x0b\n\x03\x04.\x01\x12\x04\x85\x03\x08\x0f\n\x8b\x02\n\x04\x04.\x02\0\ + \x12\x04\x8a\x03\x08\x1a\x1a\xfc\x01\x20Driver\x20is\x20used\x20to\x20de\ + fine\x20the\x20way\x20the\x20storage\x20is\x20passed\x20through\x20the\n\ + \x20virtual\x20machine.\x20It\x20can\x20be\x20\"9p\",\x20\"blk\",\x20or\ + \x20something\x20else,\x20but\x20for\n\x20all\x20cases,\x20this\x20will\ + \x20define\x20if\x20some\x20extra\x20steps\x20are\x20required\x20before\ + \n\x20this\x20storage\x20gets\x20mounted\x20into\x20the\x20container.\n\ + \n\x0f\n\x05\x04.\x02\0\x04\x12\x06\x8a\x03\x08\x85\x03\x11\n\r\n\x05\ + \x04.\x02\0\x05\x12\x04\x8a\x03\x08\x0e\n\r\n\x05\x04.\x02\0\x01\x12\x04\ + \x8a\x03\x0f\x15\n\r\n\x05\x04.\x02\0\x03\x12\x04\x8a\x03\x18\x19\n\xd0\ + \x01\n\x04\x04.\x02\x01\x12\x04\x8e\x03\x08+\x1a\xc1\x01\x20DriverOption\ + s\x20allows\x20the\x20caller\x20to\x20define\x20a\x20list\x20of\x20optio\ + ns\x20such\n\x20as\x20block\x20sizes,\x20numbers\x20of\x20luns,\x20...\ + \x20which\x20are\x20very\x20specific\x20to\n\x20every\x20device\x20and\ + \x20cannot\x20be\x20generalized\x20through\x20extra\x20fields.\n\n\r\n\ + \x05\x04.\x02\x01\x04\x12\x04\x8e\x03\x08\x10\n\r\n\x05\x04.\x02\x01\x05\ + \x12\x04\x8e\x03\x11\x17\n\r\n\x05\x04.\x02\x01\x01\x12\x04\x8e\x03\x18&\ + \n\r\n\x05\x04.\x02\x01\x03\x12\x04\x8e\x03)*\n\xce\x02\n\x04\x04.\x02\ + \x02\x12\x04\x94\x03\x08\x1a\x1a\xbf\x02\x20Source\x20can\x20be\x20anyth\ + ing\x20representing\x20the\x20source\x20of\x20the\x20storage.\x20This\n\ + \x20will\x20be\x20handled\x20by\x20the\x20proper\x20handler\x20based\x20\ + on\x20the\x20Driver\x20used.\n\x20For\x20instance,\x20it\x20can\x20be\ + \x20a\x20very\x20simple\x20path\x20if\x20the\x20caller\x20knows\x20the\n\ + \x20name\x20of\x20device\x20inside\x20the\x20VM,\x20or\x20it\x20can\x20b\ + e\x20some\x20sort\x20of\x20identifier\n\x20to\x20let\x20the\x20agent\x20\ + find\x20the\x20device\x20inside\x20the\x20VM.\n\n\x0f\n\x05\x04.\x02\x02\ + \x04\x12\x06\x94\x03\x08\x8e\x03+\n\r\n\x05\x04.\x02\x02\x05\x12\x04\x94\ + \x03\x08\x0e\n\r\n\x05\x04.\x02\x02\x01\x12\x04\x94\x03\x0f\x15\n\r\n\ + \x05\x04.\x02\x02\x03\x12\x04\x94\x03\x18\x19\n\xdb\x01\n\x04\x04.\x02\ + \x03\x12\x04\x98\x03\x08\x1a\x1a\xcc\x01\x20Fstype\x20represents\x20the\ + \x20filesystem\x20that\x20needs\x20to\x20be\x20used\x20to\x20mount\x20th\ + e\n\x20storage\x20inside\x20the\x20VM.\x20For\x20instance,\x20it\x20coul\ + d\x20be\x20\"xfs\"\x20for\x20block\n\x20device,\x20\"9p\"\x20for\x20shar\ + ed\x20filesystem,\x20or\x20\"tmpfs\"\x20for\x20shared\x20/dev/shm.\n\n\ + \x0f\n\x05\x04.\x02\x03\x04\x12\x06\x98\x03\x08\x94\x03\x1a\n\r\n\x05\ + \x04.\x02\x03\x05\x12\x04\x98\x03\x08\x0e\n\r\n\x05\x04.\x02\x03\x01\x12\ + \x04\x98\x03\x0f\x15\n\r\n\x05\x04.\x02\x03\x03\x12\x04\x98\x03\x18\x19\ + \nw\n\x04\x04.\x02\x04\x12\x04\x9b\x03\x08$\x1ai\x20Options\x20describes\ + \x20the\x20additional\x20options\x20that\x20might\x20be\x20needed\x20to\ + \n\x20mount\x20properly\x20the\x20storage\x20filesytem.\n\n\r\n\x05\x04.\ + \x02\x04\x04\x12\x04\x9b\x03\x08\x10\n\r\n\x05\x04.\x02\x04\x05\x12\x04\ + \x9b\x03\x11\x17\n\r\n\x05\x04.\x02\x04\x01\x12\x04\x9b\x03\x18\x1f\n\r\ + \n\x05\x04.\x02\x04\x03\x12\x04\x9b\x03\"#\na\n\x04\x04.\x02\x05\x12\x04\ + \x9e\x03\x08\x1f\x1aS\x20MountPoint\x20refers\x20to\x20the\x20path\x20wh\ + ere\x20the\x20storage\x20should\x20be\x20mounted\n\x20inside\x20the\x20V\ + M.\n\n\x0f\n\x05\x04.\x02\x05\x04\x12\x06\x9e\x03\x08\x9b\x03$\n\r\n\x05\ + \x04.\x02\x05\x05\x12\x04\x9e\x03\x08\x0e\n\r\n\x05\x04.\x02\x05\x01\x12\ + \x04\x9e\x03\x0f\x1a\n\r\n\x05\x04.\x02\x05\x03\x12\x04\x9e\x03\x1d\x1e\ + \n\x88\x01\n\x02\x04/\x12\x06\xa3\x03\0\xc3\x03\x01\x1az\x20Device\x20re\ + presents\x20only\x20the\x20devices\x20that\x20could\x20have\x20been\x20d\ + efined\x20through\x20the\n\x20Linux\x20Device\x20list\x20of\x20the\x20OC\ + I\x20specification.\n\n\x0b\n\x03\x04/\x01\x12\x04\xa3\x03\x08\x0e\n\xb0\ + \x01\n\x04\x04/\x02\0\x12\x04\xa7\x03\x08\x16\x1a\xa1\x01\x20Id\x20can\ + \x20be\x20used\x20to\x20identify\x20the\x20device\x20inside\x20the\x20VM\ + .\x20Some\x20devices\n\x20might\x20not\x20need\x20it\x20to\x20be\x20iden\ + tified\x20on\x20the\x20VM,\x20and\x20will\x20rely\x20on\x20the\n\x20prov\ + ided\x20VmPath\x20instead.\n\n\x0f\n\x05\x04/\x02\0\x04\x12\x06\xa7\x03\ + \x08\xa3\x03\x10\n\r\n\x05\x04/\x02\0\x05\x12\x04\xa7\x03\x08\x0e\n\r\n\ + \x05\x04/\x02\0\x01\x12\x04\xa7\x03\x0f\x11\n\r\n\x05\x04/\x02\0\x03\x12\ + \x04\xa7\x03\x14\x15\n\xbd\x01\n\x04\x04/\x02\x01\x12\x04\xac\x03\x08\ + \x18\x1a\xae\x01\x20Type\x20defines\x20the\x20type\x20of\x20device\x20de\ + scribed.\x20This\x20can\x20be\x20\"blk\",\n\x20\"scsi\",\x20\"vfio\",\ + \x20...\n\x20Particularly,\x20this\x20should\x20be\x20used\x20to\x20trig\ + ger\x20the\x20use\x20of\x20the\n\x20appropriate\x20device\x20handler.\n\ + \n\x0f\n\x05\x04/\x02\x01\x04\x12\x06\xac\x03\x08\xa7\x03\x16\n\r\n\x05\ + \x04/\x02\x01\x05\x12\x04\xac\x03\x08\x0e\n\r\n\x05\x04/\x02\x01\x01\x12\ + \x04\xac\x03\x0f\x13\n\r\n\x05\x04/\x02\x01\x03\x12\x04\xac\x03\x16\x17\ + \n\xab\x02\n\x04\x04/\x02\x02\x12\x04\xb2\x03\x08\x1b\x1a\x9c\x02\x20VmP\ + ath\x20can\x20be\x20used\x20by\x20the\x20caller\x20to\x20provide\x20dire\ + ctly\x20the\x20path\x20of\n\x20the\x20device\x20as\x20it\x20will\x20appe\ + ar\x20inside\x20the\x20VM.\x20For\x20some\x20devices,\x20the\n\x20device\ + \x20id\x20or\x20the\x20list\x20of\x20options\x20passed\x20might\x20not\ + \x20be\x20enough\x20to\x20find\n\x20the\x20device.\x20In\x20those\x20cas\ + es,\x20the\x20caller\x20should\x20predict\x20and\x20provide\n\x20this\ + \x20vm_path.\n\n\x0f\n\x05\x04/\x02\x02\x04\x12\x06\xb2\x03\x08\xac\x03\ + \x18\n\r\n\x05\x04/\x02\x02\x05\x12\x04\xb2\x03\x08\x0e\n\r\n\x05\x04/\ + \x02\x02\x01\x12\x04\xb2\x03\x0f\x16\n\r\n\x05\x04/\x02\x02\x03\x12\x04\ + \xb2\x03\x19\x1a\n\xd4\x05\n\x04\x04/\x02\x03\x12\x04\xbe\x03\x08\"\x1a\ + \xc5\x05\x20ContainerPath\x20defines\x20the\x20path\x20where\x20the\x20d\ + evice\x20should\x20be\x20found\x20inside\n\x20the\x20container.\x20This\ + \x20path\x20should\x20match\x20the\x20path\x20of\x20the\x20device\x20fro\ + m\n\x20the\x20device\x20list\x20listed\x20inside\x20the\x20OCI\x20spec.\ + \x20This\x20is\x20used\x20in\x20order\n\x20to\x20identify\x20the\x20righ\ + t\x20device\x20in\x20the\x20spec\x20and\x20update\x20it\x20with\x20the\n\ + \x20right\x20options\x20such\x20as\x20major/minor\x20numbers\x20as\x20th\ + ey\x20appear\x20inside\n\x20the\x20VM\x20for\x20instance.\x20Note\x20tha\ + t\x20an\x20empty\x20ctr_path\x20should\x20be\x20used\n\x20to\x20make\x20\ + sure\x20the\x20device\x20handler\x20inside\x20the\x20agent\x20is\x20call\ + ed,\x20but\n\x20no\x20spec\x20update\x20needs\x20to\x20be\x20performed.\ + \x20This\x20has\x20to\x20happen\x20for\x20the\n\x20case\x20of\x20rootfs,\ + \x20when\x20a\x20device\x20has\x20to\x20be\x20waited\x20for\x20after\x20\ + it\x20has\n\x20been\x20hotplugged.\x20An\x20equivalent\x20Storage\x20ent\ + ry\x20should\x20be\x20defined\x20if\n\x20any\x20mount\x20needs\x20to\x20\ + be\x20performed\x20afterwards.\n\n\x0f\n\x05\x04/\x02\x03\x04\x12\x06\ + \xbe\x03\x08\xb2\x03\x1b\n\r\n\x05\x04/\x02\x03\x05\x12\x04\xbe\x03\x08\ + \x0e\n\r\n\x05\x04/\x02\x03\x01\x12\x04\xbe\x03\x0f\x1d\n\r\n\x05\x04/\ + \x02\x03\x03\x12\x04\xbe\x03\x20!\n\xca\x01\n\x04\x04/\x02\x04\x12\x04\ + \xc2\x03\x08$\x1a\xbb\x01\x20Options\x20allows\x20the\x20caller\x20to\ + \x20define\x20a\x20list\x20of\x20options\x20such\x20as\x20block\n\x20siz\ + es,\x20numbers\x20of\x20luns,\x20...\x20which\x20are\x20very\x20specific\ + \x20to\x20every\x20device\n\x20and\x20cannot\x20be\x20generalized\x20thr\ + ough\x20extra\x20fields.\n\n\r\n\x05\x04/\x02\x04\x04\x12\x04\xc2\x03\ + \x08\x10\n\r\n\x05\x04/\x02\x04\x05\x12\x04\xc2\x03\x11\x17\n\r\n\x05\ + \x04/\x02\x04\x01\x12\x04\xc2\x03\x18\x1f\n\r\n\x05\x04/\x02\x04\x03\x12\ + \x04\xc2\x03\"#\n\x0c\n\x02\x040\x12\x06\xc5\x03\0\xc9\x03\x01\n\x0b\n\ + \x03\x040\x01\x12\x04\xc5\x03\x08\x12\n\x0c\n\x04\x040\x02\0\x12\x04\xc6\ + \x03\x08\x17\n\x0f\n\x05\x040\x02\0\x04\x12\x06\xc6\x03\x08\xc5\x03\x14\ + \n\r\n\x05\x040\x02\0\x05\x12\x04\xc6\x03\x08\x0e\n\r\n\x05\x040\x02\0\ + \x01\x12\x04\xc6\x03\x0f\x12\n\r\n\x05\x040\x02\0\x03\x12\x04\xc6\x03\ + \x15\x16\n\x0c\n\x04\x040\x02\x01\x12\x04\xc7\x03\x08\x17\n\x0f\n\x05\ + \x040\x02\x01\x04\x12\x06\xc7\x03\x08\xc6\x03\x17\n\r\n\x05\x040\x02\x01\ + \x05\x12\x04\xc7\x03\x08\x0e\n\r\n\x05\x040\x02\x01\x01\x12\x04\xc7\x03\ + \x0f\x12\n\r\n\x05\x040\x02\x01\x03\x12\x04\xc7\x03\x15\x16\n\x0c\n\x04\ + \x040\x02\x02\x12\x04\xc8\x03\x08+\n\r\n\x05\x040\x02\x02\x04\x12\x04\ + \xc8\x03\x08\x10\n\r\n\x05\x040\x02\x02\x05\x12\x04\xc8\x03\x11\x17\n\r\ + \n\x05\x040\x02\x02\x01\x12\x04\xc8\x03\x18&\n\r\n\x05\x040\x02\x02\x03\ + \x12\x04\xc8\x03)*\n\x0c\n\x02\x041\x12\x06\xcb\x03\0\xdf\x03\x01\n\x0b\ + \n\x03\x041\x01\x12\x04\xcb\x03\x08\x17\nj\n\x04\x041\x02\0\x12\x04\xce\ + \x03\x08\x18\x1a\\\x20Path\x20is\x20the\x20destination\x20file\x20in\x20\ + the\x20guest.\x20It\x20must\x20be\x20absolute,\n\x20canonical\x20and\x20\ + below\x20/run.\n\n\x0f\n\x05\x041\x02\0\x04\x12\x06\xce\x03\x08\xcb\x03\ + \x19\n\r\n\x05\x041\x02\0\x05\x12\x04\xce\x03\x08\x0e\n\r\n\x05\x041\x02\ + \0\x01\x12\x04\xce\x03\x0f\x13\n\r\n\x05\x041\x02\0\x03\x12\x04\xce\x03\ + \x16\x17\n\xbd\x01\n\x04\x041\x02\x01\x12\x04\xd2\x03\x08\x1c\x1a\xae\ + \x01\x20FileSize\x20is\x20the\x20expected\x20file\x20size,\x20for\x20sec\ + urity\x20reasons\x20write\x20operations\n\x20are\x20made\x20in\x20a\x20t\ + emporary\x20file,\x20once\x20it\x20has\x20the\x20expected\x20size,\x20it\ + 's\x20moved\n\x20to\x20the\x20destination\x20path.\n\n\x0f\n\x05\x041\ + \x02\x01\x04\x12\x06\xd2\x03\x08\xce\x03\x18\n\r\n\x05\x041\x02\x01\x05\ + \x12\x04\xd2\x03\x08\r\n\r\n\x05\x041\x02\x01\x01\x12\x04\xd2\x03\x0e\ + \x17\n\r\n\x05\x041\x02\x01\x03\x12\x04\xd2\x03\x1a\x1b\n*\n\x04\x041\ + \x02\x02\x12\x04\xd4\x03\x08\x1d\x1a\x1c\x20FileMode\x20is\x20the\x20fil\ + e\x20mode.\n\n\x0f\n\x05\x041\x02\x02\x04\x12\x06\xd4\x03\x08\xd2\x03\ + \x1c\n\r\n\x05\x041\x02\x02\x05\x12\x04\xd4\x03\x08\x0e\n\r\n\x05\x041\ + \x02\x02\x01\x12\x04\xd4\x03\x0f\x18\n\r\n\x05\x041\x02\x02\x03\x12\x04\ + \xd4\x03\x1b\x1c\nS\n\x04\x041\x02\x03\x12\x04\xd6\x03\x08\x1c\x1aE\x20D\ + irMode\x20is\x20the\x20mode\x20for\x20the\x20parent\x20directories\x20of\ + \x20destination\x20path.\n\n\x0f\n\x05\x041\x02\x03\x04\x12\x06\xd6\x03\ + \x08\xd4\x03\x1d\n\r\n\x05\x041\x02\x03\x05\x12\x04\xd6\x03\x08\x0e\n\r\ + \n\x05\x041\x02\x03\x01\x12\x04\xd6\x03\x0f\x17\n\r\n\x05\x041\x02\x03\ + \x03\x12\x04\xd6\x03\x1a\x1b\n+\n\x04\x041\x02\x04\x12\x04\xd8\x03\x08\ + \x16\x1a\x1d\x20Uid\x20is\x20the\x20numeric\x20user\x20id.\n\n\x0f\n\x05\ + \x041\x02\x04\x04\x12\x06\xd8\x03\x08\xd6\x03\x1c\n\r\n\x05\x041\x02\x04\ + \x05\x12\x04\xd8\x03\x08\r\n\r\n\x05\x041\x02\x04\x01\x12\x04\xd8\x03\ + \x0e\x11\n\r\n\x05\x041\x02\x04\x03\x12\x04\xd8\x03\x14\x15\n,\n\x04\x04\ + 1\x02\x05\x12\x04\xda\x03\x08\x16\x1a\x1e\x20Gid\x20is\x20the\x20numeric\ + \x20group\x20id.\n\n\x0f\n\x05\x041\x02\x05\x04\x12\x06\xda\x03\x08\xd8\ + \x03\x16\n\r\n\x05\x041\x02\x05\x05\x12\x04\xda\x03\x08\r\n\r\n\x05\x041\ + \x02\x05\x01\x12\x04\xda\x03\x0e\x11\n\r\n\x05\x041\x02\x05\x03\x12\x04\ + \xda\x03\x14\x15\n4\n\x04\x041\x02\x06\x12\x04\xdc\x03\x08\x19\x1a&\x20O\ + ffset\x20for\x20the\x20next\x20write\x20operation.\n\n\x0f\n\x05\x041\ + \x02\x06\x04\x12\x06\xdc\x03\x08\xda\x03\x16\n\r\n\x05\x041\x02\x06\x05\ + \x12\x04\xdc\x03\x08\r\n\r\n\x05\x041\x02\x06\x01\x12\x04\xdc\x03\x0e\ + \x14\n\r\n\x05\x041\x02\x06\x03\x12\x04\xdc\x03\x17\x18\n6\n\x04\x041\ + \x02\x07\x12\x04\xde\x03\x08\x17\x1a(\x20Data\x20to\x20write\x20in\x20th\ + e\x20destination\x20file.\n\n\x0f\n\x05\x041\x02\x07\x04\x12\x06\xde\x03\ + \x08\xdc\x03\x19\n\r\n\x05\x041\x02\x07\x05\x12\x04\xde\x03\x08\r\n\r\n\ + \x05\x041\x02\x07\x01\x12\x04\xde\x03\x0e\x12\n\r\n\x05\x041\x02\x07\x03\ + \x12\x04\xde\x03\x15\x16\n\x0c\n\x02\x042\x12\x06\xe1\x03\0\xe2\x03\x01\ + \n\x0b\n\x03\x042\x01\x12\x04\xe1\x03\x08\x1b\n\x0c\n\x02\x043\x12\x06\ + \xe4\x03\0\xe5\x03\x01\n\x0b\n\x03\x043\x01\x12\x04\xe4\x03\x08\x1ab\x06\ + proto3\ +"; + +static mut file_descriptor_proto_lazy: ::protobuf::lazy::Lazy<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::descriptor::FileDescriptorProto, +}; + +fn parse_descriptor_proto() -> ::protobuf::descriptor::FileDescriptorProto { + ::protobuf::parse_from_bytes(file_descriptor_proto_data).unwrap() +} + +pub fn file_descriptor_proto() -> &'static ::protobuf::descriptor::FileDescriptorProto { + unsafe { + file_descriptor_proto_lazy.get(|| { + parse_descriptor_proto() + }) + } +} diff --git a/src/agent/protocols/src/agent_grpc.rs b/src/agent/protocols/src/agent_grpc.rs new file mode 100644 index 0000000000..83657c026f --- /dev/null +++ b/src/agent/protocols/src/agent_grpc.rs @@ -0,0 +1,883 @@ +// This file is generated. Do not edit +// @generated + +// https://github.com/Manishearth/rust-clippy/issues/702 +#![allow(unknown_lints)] +#![allow(clippy)] + +#![cfg_attr(rustfmt, rustfmt_skip)] + +#![allow(box_pointers)] +#![allow(dead_code)] +#![allow(missing_docs)] +#![allow(non_camel_case_types)] +#![allow(non_snake_case)] +#![allow(non_upper_case_globals)] +#![allow(trivial_casts)] +#![allow(unsafe_code)] +#![allow(unused_imports)] +#![allow(unused_results)] + +const METHOD_AGENT_SERVICE_CREATE_CONTAINER: ::grpcio::Method = ::grpcio::Method { + ty: ::grpcio::MethodType::Unary, + name: "/grpc.AgentService/CreateContainer", + req_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, + resp_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, +}; + +const METHOD_AGENT_SERVICE_START_CONTAINER: ::grpcio::Method = ::grpcio::Method { + ty: ::grpcio::MethodType::Unary, + name: "/grpc.AgentService/StartContainer", + req_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, + resp_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, +}; + +const METHOD_AGENT_SERVICE_REMOVE_CONTAINER: ::grpcio::Method = ::grpcio::Method { + ty: ::grpcio::MethodType::Unary, + name: "/grpc.AgentService/RemoveContainer", + req_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, + resp_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, +}; + +const METHOD_AGENT_SERVICE_EXEC_PROCESS: ::grpcio::Method = ::grpcio::Method { + ty: ::grpcio::MethodType::Unary, + name: "/grpc.AgentService/ExecProcess", + req_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, + resp_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, +}; + +const METHOD_AGENT_SERVICE_SIGNAL_PROCESS: ::grpcio::Method = ::grpcio::Method { + ty: ::grpcio::MethodType::Unary, + name: "/grpc.AgentService/SignalProcess", + req_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, + resp_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, +}; + +const METHOD_AGENT_SERVICE_WAIT_PROCESS: ::grpcio::Method = ::grpcio::Method { + ty: ::grpcio::MethodType::Unary, + name: "/grpc.AgentService/WaitProcess", + req_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, + resp_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, +}; + +const METHOD_AGENT_SERVICE_LIST_PROCESSES: ::grpcio::Method = ::grpcio::Method { + ty: ::grpcio::MethodType::Unary, + name: "/grpc.AgentService/ListProcesses", + req_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, + resp_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, +}; + +const METHOD_AGENT_SERVICE_UPDATE_CONTAINER: ::grpcio::Method = ::grpcio::Method { + ty: ::grpcio::MethodType::Unary, + name: "/grpc.AgentService/UpdateContainer", + req_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, + resp_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, +}; + +const METHOD_AGENT_SERVICE_STATS_CONTAINER: ::grpcio::Method = ::grpcio::Method { + ty: ::grpcio::MethodType::Unary, + name: "/grpc.AgentService/StatsContainer", + req_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, + resp_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, +}; + +const METHOD_AGENT_SERVICE_PAUSE_CONTAINER: ::grpcio::Method = ::grpcio::Method { + ty: ::grpcio::MethodType::Unary, + name: "/grpc.AgentService/PauseContainer", + req_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, + resp_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, +}; + +const METHOD_AGENT_SERVICE_RESUME_CONTAINER: ::grpcio::Method = ::grpcio::Method { + ty: ::grpcio::MethodType::Unary, + name: "/grpc.AgentService/ResumeContainer", + req_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, + resp_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, +}; + +const METHOD_AGENT_SERVICE_WRITE_STDIN: ::grpcio::Method = ::grpcio::Method { + ty: ::grpcio::MethodType::Unary, + name: "/grpc.AgentService/WriteStdin", + req_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, + resp_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, +}; + +const METHOD_AGENT_SERVICE_READ_STDOUT: ::grpcio::Method = ::grpcio::Method { + ty: ::grpcio::MethodType::Unary, + name: "/grpc.AgentService/ReadStdout", + req_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, + resp_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, +}; + +const METHOD_AGENT_SERVICE_READ_STDERR: ::grpcio::Method = ::grpcio::Method { + ty: ::grpcio::MethodType::Unary, + name: "/grpc.AgentService/ReadStderr", + req_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, + resp_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, +}; + +const METHOD_AGENT_SERVICE_CLOSE_STDIN: ::grpcio::Method = ::grpcio::Method { + ty: ::grpcio::MethodType::Unary, + name: "/grpc.AgentService/CloseStdin", + req_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, + resp_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, +}; + +const METHOD_AGENT_SERVICE_TTY_WIN_RESIZE: ::grpcio::Method = ::grpcio::Method { + ty: ::grpcio::MethodType::Unary, + name: "/grpc.AgentService/TtyWinResize", + req_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, + resp_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, +}; + +const METHOD_AGENT_SERVICE_UPDATE_INTERFACE: ::grpcio::Method = ::grpcio::Method { + ty: ::grpcio::MethodType::Unary, + name: "/grpc.AgentService/UpdateInterface", + req_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, + resp_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, +}; + +const METHOD_AGENT_SERVICE_UPDATE_ROUTES: ::grpcio::Method = ::grpcio::Method { + ty: ::grpcio::MethodType::Unary, + name: "/grpc.AgentService/UpdateRoutes", + req_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, + resp_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, +}; + +const METHOD_AGENT_SERVICE_LIST_INTERFACES: ::grpcio::Method = ::grpcio::Method { + ty: ::grpcio::MethodType::Unary, + name: "/grpc.AgentService/ListInterfaces", + req_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, + resp_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, +}; + +const METHOD_AGENT_SERVICE_LIST_ROUTES: ::grpcio::Method = ::grpcio::Method { + ty: ::grpcio::MethodType::Unary, + name: "/grpc.AgentService/ListRoutes", + req_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, + resp_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, +}; + +const METHOD_AGENT_SERVICE_START_TRACING: ::grpcio::Method = ::grpcio::Method { + ty: ::grpcio::MethodType::Unary, + name: "/grpc.AgentService/StartTracing", + req_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, + resp_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, +}; + +const METHOD_AGENT_SERVICE_STOP_TRACING: ::grpcio::Method = ::grpcio::Method { + ty: ::grpcio::MethodType::Unary, + name: "/grpc.AgentService/StopTracing", + req_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, + resp_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, +}; + +const METHOD_AGENT_SERVICE_CREATE_SANDBOX: ::grpcio::Method = ::grpcio::Method { + ty: ::grpcio::MethodType::Unary, + name: "/grpc.AgentService/CreateSandbox", + req_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, + resp_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, +}; + +const METHOD_AGENT_SERVICE_DESTROY_SANDBOX: ::grpcio::Method = ::grpcio::Method { + ty: ::grpcio::MethodType::Unary, + name: "/grpc.AgentService/DestroySandbox", + req_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, + resp_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, +}; + +const METHOD_AGENT_SERVICE_ONLINE_CPU_MEM: ::grpcio::Method = ::grpcio::Method { + ty: ::grpcio::MethodType::Unary, + name: "/grpc.AgentService/OnlineCPUMem", + req_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, + resp_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, +}; + +const METHOD_AGENT_SERVICE_RESEED_RANDOM_DEV: ::grpcio::Method = ::grpcio::Method { + ty: ::grpcio::MethodType::Unary, + name: "/grpc.AgentService/ReseedRandomDev", + req_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, + resp_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, +}; + +const METHOD_AGENT_SERVICE_GET_GUEST_DETAILS: ::grpcio::Method = ::grpcio::Method { + ty: ::grpcio::MethodType::Unary, + name: "/grpc.AgentService/GetGuestDetails", + req_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, + resp_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, +}; + +const METHOD_AGENT_SERVICE_MEM_HOTPLUG_BY_PROBE: ::grpcio::Method = ::grpcio::Method { + ty: ::grpcio::MethodType::Unary, + name: "/grpc.AgentService/MemHotplugByProbe", + req_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, + resp_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, +}; + +const METHOD_AGENT_SERVICE_SET_GUEST_DATE_TIME: ::grpcio::Method = ::grpcio::Method { + ty: ::grpcio::MethodType::Unary, + name: "/grpc.AgentService/SetGuestDateTime", + req_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, + resp_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, +}; + +const METHOD_AGENT_SERVICE_COPY_FILE: ::grpcio::Method = ::grpcio::Method { + ty: ::grpcio::MethodType::Unary, + name: "/grpc.AgentService/CopyFile", + req_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, + resp_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, +}; + +#[derive(Clone)] +pub struct AgentServiceClient { + client: ::grpcio::Client, +} + +impl AgentServiceClient { + pub fn new(channel: ::grpcio::Channel) -> Self { + AgentServiceClient { + client: ::grpcio::Client::new(channel), + } + } + + pub fn create_container_opt(&self, req: &super::agent::CreateContainerRequest, opt: ::grpcio::CallOption) -> ::grpcio::Result { + self.client.unary_call(&METHOD_AGENT_SERVICE_CREATE_CONTAINER, req, opt) + } + + pub fn create_container(&self, req: &super::agent::CreateContainerRequest) -> ::grpcio::Result { + self.create_container_opt(req, ::grpcio::CallOption::default()) + } + + pub fn create_container_async_opt(&self, req: &super::agent::CreateContainerRequest, opt: ::grpcio::CallOption) -> ::grpcio::Result<::grpcio::ClientUnaryReceiver> { + self.client.unary_call_async(&METHOD_AGENT_SERVICE_CREATE_CONTAINER, req, opt) + } + + pub fn create_container_async(&self, req: &super::agent::CreateContainerRequest) -> ::grpcio::Result<::grpcio::ClientUnaryReceiver> { + self.create_container_async_opt(req, ::grpcio::CallOption::default()) + } + + pub fn start_container_opt(&self, req: &super::agent::StartContainerRequest, opt: ::grpcio::CallOption) -> ::grpcio::Result { + self.client.unary_call(&METHOD_AGENT_SERVICE_START_CONTAINER, req, opt) + } + + pub fn start_container(&self, req: &super::agent::StartContainerRequest) -> ::grpcio::Result { + self.start_container_opt(req, ::grpcio::CallOption::default()) + } + + pub fn start_container_async_opt(&self, req: &super::agent::StartContainerRequest, opt: ::grpcio::CallOption) -> ::grpcio::Result<::grpcio::ClientUnaryReceiver> { + self.client.unary_call_async(&METHOD_AGENT_SERVICE_START_CONTAINER, req, opt) + } + + pub fn start_container_async(&self, req: &super::agent::StartContainerRequest) -> ::grpcio::Result<::grpcio::ClientUnaryReceiver> { + self.start_container_async_opt(req, ::grpcio::CallOption::default()) + } + + pub fn remove_container_opt(&self, req: &super::agent::RemoveContainerRequest, opt: ::grpcio::CallOption) -> ::grpcio::Result { + self.client.unary_call(&METHOD_AGENT_SERVICE_REMOVE_CONTAINER, req, opt) + } + + pub fn remove_container(&self, req: &super::agent::RemoveContainerRequest) -> ::grpcio::Result { + self.remove_container_opt(req, ::grpcio::CallOption::default()) + } + + pub fn remove_container_async_opt(&self, req: &super::agent::RemoveContainerRequest, opt: ::grpcio::CallOption) -> ::grpcio::Result<::grpcio::ClientUnaryReceiver> { + self.client.unary_call_async(&METHOD_AGENT_SERVICE_REMOVE_CONTAINER, req, opt) + } + + pub fn remove_container_async(&self, req: &super::agent::RemoveContainerRequest) -> ::grpcio::Result<::grpcio::ClientUnaryReceiver> { + self.remove_container_async_opt(req, ::grpcio::CallOption::default()) + } + + pub fn exec_process_opt(&self, req: &super::agent::ExecProcessRequest, opt: ::grpcio::CallOption) -> ::grpcio::Result { + self.client.unary_call(&METHOD_AGENT_SERVICE_EXEC_PROCESS, req, opt) + } + + pub fn exec_process(&self, req: &super::agent::ExecProcessRequest) -> ::grpcio::Result { + self.exec_process_opt(req, ::grpcio::CallOption::default()) + } + + pub fn exec_process_async_opt(&self, req: &super::agent::ExecProcessRequest, opt: ::grpcio::CallOption) -> ::grpcio::Result<::grpcio::ClientUnaryReceiver> { + self.client.unary_call_async(&METHOD_AGENT_SERVICE_EXEC_PROCESS, req, opt) + } + + pub fn exec_process_async(&self, req: &super::agent::ExecProcessRequest) -> ::grpcio::Result<::grpcio::ClientUnaryReceiver> { + self.exec_process_async_opt(req, ::grpcio::CallOption::default()) + } + + pub fn signal_process_opt(&self, req: &super::agent::SignalProcessRequest, opt: ::grpcio::CallOption) -> ::grpcio::Result { + self.client.unary_call(&METHOD_AGENT_SERVICE_SIGNAL_PROCESS, req, opt) + } + + pub fn signal_process(&self, req: &super::agent::SignalProcessRequest) -> ::grpcio::Result { + self.signal_process_opt(req, ::grpcio::CallOption::default()) + } + + pub fn signal_process_async_opt(&self, req: &super::agent::SignalProcessRequest, opt: ::grpcio::CallOption) -> ::grpcio::Result<::grpcio::ClientUnaryReceiver> { + self.client.unary_call_async(&METHOD_AGENT_SERVICE_SIGNAL_PROCESS, req, opt) + } + + pub fn signal_process_async(&self, req: &super::agent::SignalProcessRequest) -> ::grpcio::Result<::grpcio::ClientUnaryReceiver> { + self.signal_process_async_opt(req, ::grpcio::CallOption::default()) + } + + pub fn wait_process_opt(&self, req: &super::agent::WaitProcessRequest, opt: ::grpcio::CallOption) -> ::grpcio::Result { + self.client.unary_call(&METHOD_AGENT_SERVICE_WAIT_PROCESS, req, opt) + } + + pub fn wait_process(&self, req: &super::agent::WaitProcessRequest) -> ::grpcio::Result { + self.wait_process_opt(req, ::grpcio::CallOption::default()) + } + + pub fn wait_process_async_opt(&self, req: &super::agent::WaitProcessRequest, opt: ::grpcio::CallOption) -> ::grpcio::Result<::grpcio::ClientUnaryReceiver> { + self.client.unary_call_async(&METHOD_AGENT_SERVICE_WAIT_PROCESS, req, opt) + } + + pub fn wait_process_async(&self, req: &super::agent::WaitProcessRequest) -> ::grpcio::Result<::grpcio::ClientUnaryReceiver> { + self.wait_process_async_opt(req, ::grpcio::CallOption::default()) + } + + pub fn list_processes_opt(&self, req: &super::agent::ListProcessesRequest, opt: ::grpcio::CallOption) -> ::grpcio::Result { + self.client.unary_call(&METHOD_AGENT_SERVICE_LIST_PROCESSES, req, opt) + } + + pub fn list_processes(&self, req: &super::agent::ListProcessesRequest) -> ::grpcio::Result { + self.list_processes_opt(req, ::grpcio::CallOption::default()) + } + + pub fn list_processes_async_opt(&self, req: &super::agent::ListProcessesRequest, opt: ::grpcio::CallOption) -> ::grpcio::Result<::grpcio::ClientUnaryReceiver> { + self.client.unary_call_async(&METHOD_AGENT_SERVICE_LIST_PROCESSES, req, opt) + } + + pub fn list_processes_async(&self, req: &super::agent::ListProcessesRequest) -> ::grpcio::Result<::grpcio::ClientUnaryReceiver> { + self.list_processes_async_opt(req, ::grpcio::CallOption::default()) + } + + pub fn update_container_opt(&self, req: &super::agent::UpdateContainerRequest, opt: ::grpcio::CallOption) -> ::grpcio::Result { + self.client.unary_call(&METHOD_AGENT_SERVICE_UPDATE_CONTAINER, req, opt) + } + + pub fn update_container(&self, req: &super::agent::UpdateContainerRequest) -> ::grpcio::Result { + self.update_container_opt(req, ::grpcio::CallOption::default()) + } + + pub fn update_container_async_opt(&self, req: &super::agent::UpdateContainerRequest, opt: ::grpcio::CallOption) -> ::grpcio::Result<::grpcio::ClientUnaryReceiver> { + self.client.unary_call_async(&METHOD_AGENT_SERVICE_UPDATE_CONTAINER, req, opt) + } + + pub fn update_container_async(&self, req: &super::agent::UpdateContainerRequest) -> ::grpcio::Result<::grpcio::ClientUnaryReceiver> { + self.update_container_async_opt(req, ::grpcio::CallOption::default()) + } + + pub fn stats_container_opt(&self, req: &super::agent::StatsContainerRequest, opt: ::grpcio::CallOption) -> ::grpcio::Result { + self.client.unary_call(&METHOD_AGENT_SERVICE_STATS_CONTAINER, req, opt) + } + + pub fn stats_container(&self, req: &super::agent::StatsContainerRequest) -> ::grpcio::Result { + self.stats_container_opt(req, ::grpcio::CallOption::default()) + } + + pub fn stats_container_async_opt(&self, req: &super::agent::StatsContainerRequest, opt: ::grpcio::CallOption) -> ::grpcio::Result<::grpcio::ClientUnaryReceiver> { + self.client.unary_call_async(&METHOD_AGENT_SERVICE_STATS_CONTAINER, req, opt) + } + + pub fn stats_container_async(&self, req: &super::agent::StatsContainerRequest) -> ::grpcio::Result<::grpcio::ClientUnaryReceiver> { + self.stats_container_async_opt(req, ::grpcio::CallOption::default()) + } + + pub fn pause_container_opt(&self, req: &super::agent::PauseContainerRequest, opt: ::grpcio::CallOption) -> ::grpcio::Result { + self.client.unary_call(&METHOD_AGENT_SERVICE_PAUSE_CONTAINER, req, opt) + } + + pub fn pause_container(&self, req: &super::agent::PauseContainerRequest) -> ::grpcio::Result { + self.pause_container_opt(req, ::grpcio::CallOption::default()) + } + + pub fn pause_container_async_opt(&self, req: &super::agent::PauseContainerRequest, opt: ::grpcio::CallOption) -> ::grpcio::Result<::grpcio::ClientUnaryReceiver> { + self.client.unary_call_async(&METHOD_AGENT_SERVICE_PAUSE_CONTAINER, req, opt) + } + + pub fn pause_container_async(&self, req: &super::agent::PauseContainerRequest) -> ::grpcio::Result<::grpcio::ClientUnaryReceiver> { + self.pause_container_async_opt(req, ::grpcio::CallOption::default()) + } + + pub fn resume_container_opt(&self, req: &super::agent::ResumeContainerRequest, opt: ::grpcio::CallOption) -> ::grpcio::Result { + self.client.unary_call(&METHOD_AGENT_SERVICE_RESUME_CONTAINER, req, opt) + } + + pub fn resume_container(&self, req: &super::agent::ResumeContainerRequest) -> ::grpcio::Result { + self.resume_container_opt(req, ::grpcio::CallOption::default()) + } + + pub fn resume_container_async_opt(&self, req: &super::agent::ResumeContainerRequest, opt: ::grpcio::CallOption) -> ::grpcio::Result<::grpcio::ClientUnaryReceiver> { + self.client.unary_call_async(&METHOD_AGENT_SERVICE_RESUME_CONTAINER, req, opt) + } + + pub fn resume_container_async(&self, req: &super::agent::ResumeContainerRequest) -> ::grpcio::Result<::grpcio::ClientUnaryReceiver> { + self.resume_container_async_opt(req, ::grpcio::CallOption::default()) + } + + pub fn write_stdin_opt(&self, req: &super::agent::WriteStreamRequest, opt: ::grpcio::CallOption) -> ::grpcio::Result { + self.client.unary_call(&METHOD_AGENT_SERVICE_WRITE_STDIN, req, opt) + } + + pub fn write_stdin(&self, req: &super::agent::WriteStreamRequest) -> ::grpcio::Result { + self.write_stdin_opt(req, ::grpcio::CallOption::default()) + } + + pub fn write_stdin_async_opt(&self, req: &super::agent::WriteStreamRequest, opt: ::grpcio::CallOption) -> ::grpcio::Result<::grpcio::ClientUnaryReceiver> { + self.client.unary_call_async(&METHOD_AGENT_SERVICE_WRITE_STDIN, req, opt) + } + + pub fn write_stdin_async(&self, req: &super::agent::WriteStreamRequest) -> ::grpcio::Result<::grpcio::ClientUnaryReceiver> { + self.write_stdin_async_opt(req, ::grpcio::CallOption::default()) + } + + pub fn read_stdout_opt(&self, req: &super::agent::ReadStreamRequest, opt: ::grpcio::CallOption) -> ::grpcio::Result { + self.client.unary_call(&METHOD_AGENT_SERVICE_READ_STDOUT, req, opt) + } + + pub fn read_stdout(&self, req: &super::agent::ReadStreamRequest) -> ::grpcio::Result { + self.read_stdout_opt(req, ::grpcio::CallOption::default()) + } + + pub fn read_stdout_async_opt(&self, req: &super::agent::ReadStreamRequest, opt: ::grpcio::CallOption) -> ::grpcio::Result<::grpcio::ClientUnaryReceiver> { + self.client.unary_call_async(&METHOD_AGENT_SERVICE_READ_STDOUT, req, opt) + } + + pub fn read_stdout_async(&self, req: &super::agent::ReadStreamRequest) -> ::grpcio::Result<::grpcio::ClientUnaryReceiver> { + self.read_stdout_async_opt(req, ::grpcio::CallOption::default()) + } + + pub fn read_stderr_opt(&self, req: &super::agent::ReadStreamRequest, opt: ::grpcio::CallOption) -> ::grpcio::Result { + self.client.unary_call(&METHOD_AGENT_SERVICE_READ_STDERR, req, opt) + } + + pub fn read_stderr(&self, req: &super::agent::ReadStreamRequest) -> ::grpcio::Result { + self.read_stderr_opt(req, ::grpcio::CallOption::default()) + } + + pub fn read_stderr_async_opt(&self, req: &super::agent::ReadStreamRequest, opt: ::grpcio::CallOption) -> ::grpcio::Result<::grpcio::ClientUnaryReceiver> { + self.client.unary_call_async(&METHOD_AGENT_SERVICE_READ_STDERR, req, opt) + } + + pub fn read_stderr_async(&self, req: &super::agent::ReadStreamRequest) -> ::grpcio::Result<::grpcio::ClientUnaryReceiver> { + self.read_stderr_async_opt(req, ::grpcio::CallOption::default()) + } + + pub fn close_stdin_opt(&self, req: &super::agent::CloseStdinRequest, opt: ::grpcio::CallOption) -> ::grpcio::Result { + self.client.unary_call(&METHOD_AGENT_SERVICE_CLOSE_STDIN, req, opt) + } + + pub fn close_stdin(&self, req: &super::agent::CloseStdinRequest) -> ::grpcio::Result { + self.close_stdin_opt(req, ::grpcio::CallOption::default()) + } + + pub fn close_stdin_async_opt(&self, req: &super::agent::CloseStdinRequest, opt: ::grpcio::CallOption) -> ::grpcio::Result<::grpcio::ClientUnaryReceiver> { + self.client.unary_call_async(&METHOD_AGENT_SERVICE_CLOSE_STDIN, req, opt) + } + + pub fn close_stdin_async(&self, req: &super::agent::CloseStdinRequest) -> ::grpcio::Result<::grpcio::ClientUnaryReceiver> { + self.close_stdin_async_opt(req, ::grpcio::CallOption::default()) + } + + pub fn tty_win_resize_opt(&self, req: &super::agent::TtyWinResizeRequest, opt: ::grpcio::CallOption) -> ::grpcio::Result { + self.client.unary_call(&METHOD_AGENT_SERVICE_TTY_WIN_RESIZE, req, opt) + } + + pub fn tty_win_resize(&self, req: &super::agent::TtyWinResizeRequest) -> ::grpcio::Result { + self.tty_win_resize_opt(req, ::grpcio::CallOption::default()) + } + + pub fn tty_win_resize_async_opt(&self, req: &super::agent::TtyWinResizeRequest, opt: ::grpcio::CallOption) -> ::grpcio::Result<::grpcio::ClientUnaryReceiver> { + self.client.unary_call_async(&METHOD_AGENT_SERVICE_TTY_WIN_RESIZE, req, opt) + } + + pub fn tty_win_resize_async(&self, req: &super::agent::TtyWinResizeRequest) -> ::grpcio::Result<::grpcio::ClientUnaryReceiver> { + self.tty_win_resize_async_opt(req, ::grpcio::CallOption::default()) + } + + pub fn update_interface_opt(&self, req: &super::agent::UpdateInterfaceRequest, opt: ::grpcio::CallOption) -> ::grpcio::Result { + self.client.unary_call(&METHOD_AGENT_SERVICE_UPDATE_INTERFACE, req, opt) + } + + pub fn update_interface(&self, req: &super::agent::UpdateInterfaceRequest) -> ::grpcio::Result { + self.update_interface_opt(req, ::grpcio::CallOption::default()) + } + + pub fn update_interface_async_opt(&self, req: &super::agent::UpdateInterfaceRequest, opt: ::grpcio::CallOption) -> ::grpcio::Result<::grpcio::ClientUnaryReceiver> { + self.client.unary_call_async(&METHOD_AGENT_SERVICE_UPDATE_INTERFACE, req, opt) + } + + pub fn update_interface_async(&self, req: &super::agent::UpdateInterfaceRequest) -> ::grpcio::Result<::grpcio::ClientUnaryReceiver> { + self.update_interface_async_opt(req, ::grpcio::CallOption::default()) + } + + pub fn update_routes_opt(&self, req: &super::agent::UpdateRoutesRequest, opt: ::grpcio::CallOption) -> ::grpcio::Result { + self.client.unary_call(&METHOD_AGENT_SERVICE_UPDATE_ROUTES, req, opt) + } + + pub fn update_routes(&self, req: &super::agent::UpdateRoutesRequest) -> ::grpcio::Result { + self.update_routes_opt(req, ::grpcio::CallOption::default()) + } + + pub fn update_routes_async_opt(&self, req: &super::agent::UpdateRoutesRequest, opt: ::grpcio::CallOption) -> ::grpcio::Result<::grpcio::ClientUnaryReceiver> { + self.client.unary_call_async(&METHOD_AGENT_SERVICE_UPDATE_ROUTES, req, opt) + } + + pub fn update_routes_async(&self, req: &super::agent::UpdateRoutesRequest) -> ::grpcio::Result<::grpcio::ClientUnaryReceiver> { + self.update_routes_async_opt(req, ::grpcio::CallOption::default()) + } + + pub fn list_interfaces_opt(&self, req: &super::agent::ListInterfacesRequest, opt: ::grpcio::CallOption) -> ::grpcio::Result { + self.client.unary_call(&METHOD_AGENT_SERVICE_LIST_INTERFACES, req, opt) + } + + pub fn list_interfaces(&self, req: &super::agent::ListInterfacesRequest) -> ::grpcio::Result { + self.list_interfaces_opt(req, ::grpcio::CallOption::default()) + } + + pub fn list_interfaces_async_opt(&self, req: &super::agent::ListInterfacesRequest, opt: ::grpcio::CallOption) -> ::grpcio::Result<::grpcio::ClientUnaryReceiver> { + self.client.unary_call_async(&METHOD_AGENT_SERVICE_LIST_INTERFACES, req, opt) + } + + pub fn list_interfaces_async(&self, req: &super::agent::ListInterfacesRequest) -> ::grpcio::Result<::grpcio::ClientUnaryReceiver> { + self.list_interfaces_async_opt(req, ::grpcio::CallOption::default()) + } + + pub fn list_routes_opt(&self, req: &super::agent::ListRoutesRequest, opt: ::grpcio::CallOption) -> ::grpcio::Result { + self.client.unary_call(&METHOD_AGENT_SERVICE_LIST_ROUTES, req, opt) + } + + pub fn list_routes(&self, req: &super::agent::ListRoutesRequest) -> ::grpcio::Result { + self.list_routes_opt(req, ::grpcio::CallOption::default()) + } + + pub fn list_routes_async_opt(&self, req: &super::agent::ListRoutesRequest, opt: ::grpcio::CallOption) -> ::grpcio::Result<::grpcio::ClientUnaryReceiver> { + self.client.unary_call_async(&METHOD_AGENT_SERVICE_LIST_ROUTES, req, opt) + } + + pub fn list_routes_async(&self, req: &super::agent::ListRoutesRequest) -> ::grpcio::Result<::grpcio::ClientUnaryReceiver> { + self.list_routes_async_opt(req, ::grpcio::CallOption::default()) + } + + pub fn start_tracing_opt(&self, req: &super::agent::StartTracingRequest, opt: ::grpcio::CallOption) -> ::grpcio::Result { + self.client.unary_call(&METHOD_AGENT_SERVICE_START_TRACING, req, opt) + } + + pub fn start_tracing(&self, req: &super::agent::StartTracingRequest) -> ::grpcio::Result { + self.start_tracing_opt(req, ::grpcio::CallOption::default()) + } + + pub fn start_tracing_async_opt(&self, req: &super::agent::StartTracingRequest, opt: ::grpcio::CallOption) -> ::grpcio::Result<::grpcio::ClientUnaryReceiver> { + self.client.unary_call_async(&METHOD_AGENT_SERVICE_START_TRACING, req, opt) + } + + pub fn start_tracing_async(&self, req: &super::agent::StartTracingRequest) -> ::grpcio::Result<::grpcio::ClientUnaryReceiver> { + self.start_tracing_async_opt(req, ::grpcio::CallOption::default()) + } + + pub fn stop_tracing_opt(&self, req: &super::agent::StopTracingRequest, opt: ::grpcio::CallOption) -> ::grpcio::Result { + self.client.unary_call(&METHOD_AGENT_SERVICE_STOP_TRACING, req, opt) + } + + pub fn stop_tracing(&self, req: &super::agent::StopTracingRequest) -> ::grpcio::Result { + self.stop_tracing_opt(req, ::grpcio::CallOption::default()) + } + + pub fn stop_tracing_async_opt(&self, req: &super::agent::StopTracingRequest, opt: ::grpcio::CallOption) -> ::grpcio::Result<::grpcio::ClientUnaryReceiver> { + self.client.unary_call_async(&METHOD_AGENT_SERVICE_STOP_TRACING, req, opt) + } + + pub fn stop_tracing_async(&self, req: &super::agent::StopTracingRequest) -> ::grpcio::Result<::grpcio::ClientUnaryReceiver> { + self.stop_tracing_async_opt(req, ::grpcio::CallOption::default()) + } + + pub fn create_sandbox_opt(&self, req: &super::agent::CreateSandboxRequest, opt: ::grpcio::CallOption) -> ::grpcio::Result { + self.client.unary_call(&METHOD_AGENT_SERVICE_CREATE_SANDBOX, req, opt) + } + + pub fn create_sandbox(&self, req: &super::agent::CreateSandboxRequest) -> ::grpcio::Result { + self.create_sandbox_opt(req, ::grpcio::CallOption::default()) + } + + pub fn create_sandbox_async_opt(&self, req: &super::agent::CreateSandboxRequest, opt: ::grpcio::CallOption) -> ::grpcio::Result<::grpcio::ClientUnaryReceiver> { + self.client.unary_call_async(&METHOD_AGENT_SERVICE_CREATE_SANDBOX, req, opt) + } + + pub fn create_sandbox_async(&self, req: &super::agent::CreateSandboxRequest) -> ::grpcio::Result<::grpcio::ClientUnaryReceiver> { + self.create_sandbox_async_opt(req, ::grpcio::CallOption::default()) + } + + pub fn destroy_sandbox_opt(&self, req: &super::agent::DestroySandboxRequest, opt: ::grpcio::CallOption) -> ::grpcio::Result { + self.client.unary_call(&METHOD_AGENT_SERVICE_DESTROY_SANDBOX, req, opt) + } + + pub fn destroy_sandbox(&self, req: &super::agent::DestroySandboxRequest) -> ::grpcio::Result { + self.destroy_sandbox_opt(req, ::grpcio::CallOption::default()) + } + + pub fn destroy_sandbox_async_opt(&self, req: &super::agent::DestroySandboxRequest, opt: ::grpcio::CallOption) -> ::grpcio::Result<::grpcio::ClientUnaryReceiver> { + self.client.unary_call_async(&METHOD_AGENT_SERVICE_DESTROY_SANDBOX, req, opt) + } + + pub fn destroy_sandbox_async(&self, req: &super::agent::DestroySandboxRequest) -> ::grpcio::Result<::grpcio::ClientUnaryReceiver> { + self.destroy_sandbox_async_opt(req, ::grpcio::CallOption::default()) + } + + pub fn online_cpu_mem_opt(&self, req: &super::agent::OnlineCPUMemRequest, opt: ::grpcio::CallOption) -> ::grpcio::Result { + self.client.unary_call(&METHOD_AGENT_SERVICE_ONLINE_CPU_MEM, req, opt) + } + + pub fn online_cpu_mem(&self, req: &super::agent::OnlineCPUMemRequest) -> ::grpcio::Result { + self.online_cpu_mem_opt(req, ::grpcio::CallOption::default()) + } + + pub fn online_cpu_mem_async_opt(&self, req: &super::agent::OnlineCPUMemRequest, opt: ::grpcio::CallOption) -> ::grpcio::Result<::grpcio::ClientUnaryReceiver> { + self.client.unary_call_async(&METHOD_AGENT_SERVICE_ONLINE_CPU_MEM, req, opt) + } + + pub fn online_cpu_mem_async(&self, req: &super::agent::OnlineCPUMemRequest) -> ::grpcio::Result<::grpcio::ClientUnaryReceiver> { + self.online_cpu_mem_async_opt(req, ::grpcio::CallOption::default()) + } + + pub fn reseed_random_dev_opt(&self, req: &super::agent::ReseedRandomDevRequest, opt: ::grpcio::CallOption) -> ::grpcio::Result { + self.client.unary_call(&METHOD_AGENT_SERVICE_RESEED_RANDOM_DEV, req, opt) + } + + pub fn reseed_random_dev(&self, req: &super::agent::ReseedRandomDevRequest) -> ::grpcio::Result { + self.reseed_random_dev_opt(req, ::grpcio::CallOption::default()) + } + + pub fn reseed_random_dev_async_opt(&self, req: &super::agent::ReseedRandomDevRequest, opt: ::grpcio::CallOption) -> ::grpcio::Result<::grpcio::ClientUnaryReceiver> { + self.client.unary_call_async(&METHOD_AGENT_SERVICE_RESEED_RANDOM_DEV, req, opt) + } + + pub fn reseed_random_dev_async(&self, req: &super::agent::ReseedRandomDevRequest) -> ::grpcio::Result<::grpcio::ClientUnaryReceiver> { + self.reseed_random_dev_async_opt(req, ::grpcio::CallOption::default()) + } + + pub fn get_guest_details_opt(&self, req: &super::agent::GuestDetailsRequest, opt: ::grpcio::CallOption) -> ::grpcio::Result { + self.client.unary_call(&METHOD_AGENT_SERVICE_GET_GUEST_DETAILS, req, opt) + } + + pub fn get_guest_details(&self, req: &super::agent::GuestDetailsRequest) -> ::grpcio::Result { + self.get_guest_details_opt(req, ::grpcio::CallOption::default()) + } + + pub fn get_guest_details_async_opt(&self, req: &super::agent::GuestDetailsRequest, opt: ::grpcio::CallOption) -> ::grpcio::Result<::grpcio::ClientUnaryReceiver> { + self.client.unary_call_async(&METHOD_AGENT_SERVICE_GET_GUEST_DETAILS, req, opt) + } + + pub fn get_guest_details_async(&self, req: &super::agent::GuestDetailsRequest) -> ::grpcio::Result<::grpcio::ClientUnaryReceiver> { + self.get_guest_details_async_opt(req, ::grpcio::CallOption::default()) + } + + pub fn mem_hotplug_by_probe_opt(&self, req: &super::agent::MemHotplugByProbeRequest, opt: ::grpcio::CallOption) -> ::grpcio::Result { + self.client.unary_call(&METHOD_AGENT_SERVICE_MEM_HOTPLUG_BY_PROBE, req, opt) + } + + pub fn mem_hotplug_by_probe(&self, req: &super::agent::MemHotplugByProbeRequest) -> ::grpcio::Result { + self.mem_hotplug_by_probe_opt(req, ::grpcio::CallOption::default()) + } + + pub fn mem_hotplug_by_probe_async_opt(&self, req: &super::agent::MemHotplugByProbeRequest, opt: ::grpcio::CallOption) -> ::grpcio::Result<::grpcio::ClientUnaryReceiver> { + self.client.unary_call_async(&METHOD_AGENT_SERVICE_MEM_HOTPLUG_BY_PROBE, req, opt) + } + + pub fn mem_hotplug_by_probe_async(&self, req: &super::agent::MemHotplugByProbeRequest) -> ::grpcio::Result<::grpcio::ClientUnaryReceiver> { + self.mem_hotplug_by_probe_async_opt(req, ::grpcio::CallOption::default()) + } + + pub fn set_guest_date_time_opt(&self, req: &super::agent::SetGuestDateTimeRequest, opt: ::grpcio::CallOption) -> ::grpcio::Result { + self.client.unary_call(&METHOD_AGENT_SERVICE_SET_GUEST_DATE_TIME, req, opt) + } + + pub fn set_guest_date_time(&self, req: &super::agent::SetGuestDateTimeRequest) -> ::grpcio::Result { + self.set_guest_date_time_opt(req, ::grpcio::CallOption::default()) + } + + pub fn set_guest_date_time_async_opt(&self, req: &super::agent::SetGuestDateTimeRequest, opt: ::grpcio::CallOption) -> ::grpcio::Result<::grpcio::ClientUnaryReceiver> { + self.client.unary_call_async(&METHOD_AGENT_SERVICE_SET_GUEST_DATE_TIME, req, opt) + } + + pub fn set_guest_date_time_async(&self, req: &super::agent::SetGuestDateTimeRequest) -> ::grpcio::Result<::grpcio::ClientUnaryReceiver> { + self.set_guest_date_time_async_opt(req, ::grpcio::CallOption::default()) + } + + pub fn copy_file_opt(&self, req: &super::agent::CopyFileRequest, opt: ::grpcio::CallOption) -> ::grpcio::Result { + self.client.unary_call(&METHOD_AGENT_SERVICE_COPY_FILE, req, opt) + } + + pub fn copy_file(&self, req: &super::agent::CopyFileRequest) -> ::grpcio::Result { + self.copy_file_opt(req, ::grpcio::CallOption::default()) + } + + pub fn copy_file_async_opt(&self, req: &super::agent::CopyFileRequest, opt: ::grpcio::CallOption) -> ::grpcio::Result<::grpcio::ClientUnaryReceiver> { + self.client.unary_call_async(&METHOD_AGENT_SERVICE_COPY_FILE, req, opt) + } + + pub fn copy_file_async(&self, req: &super::agent::CopyFileRequest) -> ::grpcio::Result<::grpcio::ClientUnaryReceiver> { + self.copy_file_async_opt(req, ::grpcio::CallOption::default()) + } + pub fn spawn(&self, f: F) where F: ::futures::Future + Send + 'static { + self.client.spawn(f) + } +} + +pub trait AgentService { + fn create_container(&mut self, ctx: ::grpcio::RpcContext, req: super::agent::CreateContainerRequest, sink: ::grpcio::UnarySink); + fn start_container(&mut self, ctx: ::grpcio::RpcContext, req: super::agent::StartContainerRequest, sink: ::grpcio::UnarySink); + fn remove_container(&mut self, ctx: ::grpcio::RpcContext, req: super::agent::RemoveContainerRequest, sink: ::grpcio::UnarySink); + fn exec_process(&mut self, ctx: ::grpcio::RpcContext, req: super::agent::ExecProcessRequest, sink: ::grpcio::UnarySink); + fn signal_process(&mut self, ctx: ::grpcio::RpcContext, req: super::agent::SignalProcessRequest, sink: ::grpcio::UnarySink); + fn wait_process(&mut self, ctx: ::grpcio::RpcContext, req: super::agent::WaitProcessRequest, sink: ::grpcio::UnarySink); + fn list_processes(&mut self, ctx: ::grpcio::RpcContext, req: super::agent::ListProcessesRequest, sink: ::grpcio::UnarySink); + fn update_container(&mut self, ctx: ::grpcio::RpcContext, req: super::agent::UpdateContainerRequest, sink: ::grpcio::UnarySink); + fn stats_container(&mut self, ctx: ::grpcio::RpcContext, req: super::agent::StatsContainerRequest, sink: ::grpcio::UnarySink); + fn pause_container(&mut self, ctx: ::grpcio::RpcContext, req: super::agent::PauseContainerRequest, sink: ::grpcio::UnarySink); + fn resume_container(&mut self, ctx: ::grpcio::RpcContext, req: super::agent::ResumeContainerRequest, sink: ::grpcio::UnarySink); + fn write_stdin(&mut self, ctx: ::grpcio::RpcContext, req: super::agent::WriteStreamRequest, sink: ::grpcio::UnarySink); + fn read_stdout(&mut self, ctx: ::grpcio::RpcContext, req: super::agent::ReadStreamRequest, sink: ::grpcio::UnarySink); + fn read_stderr(&mut self, ctx: ::grpcio::RpcContext, req: super::agent::ReadStreamRequest, sink: ::grpcio::UnarySink); + fn close_stdin(&mut self, ctx: ::grpcio::RpcContext, req: super::agent::CloseStdinRequest, sink: ::grpcio::UnarySink); + fn tty_win_resize(&mut self, ctx: ::grpcio::RpcContext, req: super::agent::TtyWinResizeRequest, sink: ::grpcio::UnarySink); + fn update_interface(&mut self, ctx: ::grpcio::RpcContext, req: super::agent::UpdateInterfaceRequest, sink: ::grpcio::UnarySink); + fn update_routes(&mut self, ctx: ::grpcio::RpcContext, req: super::agent::UpdateRoutesRequest, sink: ::grpcio::UnarySink); + fn list_interfaces(&mut self, ctx: ::grpcio::RpcContext, req: super::agent::ListInterfacesRequest, sink: ::grpcio::UnarySink); + fn list_routes(&mut self, ctx: ::grpcio::RpcContext, req: super::agent::ListRoutesRequest, sink: ::grpcio::UnarySink); + fn start_tracing(&mut self, ctx: ::grpcio::RpcContext, req: super::agent::StartTracingRequest, sink: ::grpcio::UnarySink); + fn stop_tracing(&mut self, ctx: ::grpcio::RpcContext, req: super::agent::StopTracingRequest, sink: ::grpcio::UnarySink); + fn create_sandbox(&mut self, ctx: ::grpcio::RpcContext, req: super::agent::CreateSandboxRequest, sink: ::grpcio::UnarySink); + fn destroy_sandbox(&mut self, ctx: ::grpcio::RpcContext, req: super::agent::DestroySandboxRequest, sink: ::grpcio::UnarySink); + fn online_cpu_mem(&mut self, ctx: ::grpcio::RpcContext, req: super::agent::OnlineCPUMemRequest, sink: ::grpcio::UnarySink); + fn reseed_random_dev(&mut self, ctx: ::grpcio::RpcContext, req: super::agent::ReseedRandomDevRequest, sink: ::grpcio::UnarySink); + fn get_guest_details(&mut self, ctx: ::grpcio::RpcContext, req: super::agent::GuestDetailsRequest, sink: ::grpcio::UnarySink); + fn mem_hotplug_by_probe(&mut self, ctx: ::grpcio::RpcContext, req: super::agent::MemHotplugByProbeRequest, sink: ::grpcio::UnarySink); + fn set_guest_date_time(&mut self, ctx: ::grpcio::RpcContext, req: super::agent::SetGuestDateTimeRequest, sink: ::grpcio::UnarySink); + fn copy_file(&mut self, ctx: ::grpcio::RpcContext, req: super::agent::CopyFileRequest, sink: ::grpcio::UnarySink); +} + +pub fn create_agent_service(s: S) -> ::grpcio::Service { + let mut builder = ::grpcio::ServiceBuilder::new(); + let mut instance = s.clone(); + builder = builder.add_unary_handler(&METHOD_AGENT_SERVICE_CREATE_CONTAINER, move |ctx, req, resp| { + instance.create_container(ctx, req, resp) + }); + let mut instance = s.clone(); + builder = builder.add_unary_handler(&METHOD_AGENT_SERVICE_START_CONTAINER, move |ctx, req, resp| { + instance.start_container(ctx, req, resp) + }); + let mut instance = s.clone(); + builder = builder.add_unary_handler(&METHOD_AGENT_SERVICE_REMOVE_CONTAINER, move |ctx, req, resp| { + instance.remove_container(ctx, req, resp) + }); + let mut instance = s.clone(); + builder = builder.add_unary_handler(&METHOD_AGENT_SERVICE_EXEC_PROCESS, move |ctx, req, resp| { + instance.exec_process(ctx, req, resp) + }); + let mut instance = s.clone(); + builder = builder.add_unary_handler(&METHOD_AGENT_SERVICE_SIGNAL_PROCESS, move |ctx, req, resp| { + instance.signal_process(ctx, req, resp) + }); + let mut instance = s.clone(); + builder = builder.add_unary_handler(&METHOD_AGENT_SERVICE_WAIT_PROCESS, move |ctx, req, resp| { + instance.wait_process(ctx, req, resp) + }); + let mut instance = s.clone(); + builder = builder.add_unary_handler(&METHOD_AGENT_SERVICE_LIST_PROCESSES, move |ctx, req, resp| { + instance.list_processes(ctx, req, resp) + }); + let mut instance = s.clone(); + builder = builder.add_unary_handler(&METHOD_AGENT_SERVICE_UPDATE_CONTAINER, move |ctx, req, resp| { + instance.update_container(ctx, req, resp) + }); + let mut instance = s.clone(); + builder = builder.add_unary_handler(&METHOD_AGENT_SERVICE_STATS_CONTAINER, move |ctx, req, resp| { + instance.stats_container(ctx, req, resp) + }); + let mut instance = s.clone(); + builder = builder.add_unary_handler(&METHOD_AGENT_SERVICE_PAUSE_CONTAINER, move |ctx, req, resp| { + instance.pause_container(ctx, req, resp) + }); + let mut instance = s.clone(); + builder = builder.add_unary_handler(&METHOD_AGENT_SERVICE_RESUME_CONTAINER, move |ctx, req, resp| { + instance.resume_container(ctx, req, resp) + }); + let mut instance = s.clone(); + builder = builder.add_unary_handler(&METHOD_AGENT_SERVICE_WRITE_STDIN, move |ctx, req, resp| { + instance.write_stdin(ctx, req, resp) + }); + let mut instance = s.clone(); + builder = builder.add_unary_handler(&METHOD_AGENT_SERVICE_READ_STDOUT, move |ctx, req, resp| { + instance.read_stdout(ctx, req, resp) + }); + let mut instance = s.clone(); + builder = builder.add_unary_handler(&METHOD_AGENT_SERVICE_READ_STDERR, move |ctx, req, resp| { + instance.read_stderr(ctx, req, resp) + }); + let mut instance = s.clone(); + builder = builder.add_unary_handler(&METHOD_AGENT_SERVICE_CLOSE_STDIN, move |ctx, req, resp| { + instance.close_stdin(ctx, req, resp) + }); + let mut instance = s.clone(); + builder = builder.add_unary_handler(&METHOD_AGENT_SERVICE_TTY_WIN_RESIZE, move |ctx, req, resp| { + instance.tty_win_resize(ctx, req, resp) + }); + let mut instance = s.clone(); + builder = builder.add_unary_handler(&METHOD_AGENT_SERVICE_UPDATE_INTERFACE, move |ctx, req, resp| { + instance.update_interface(ctx, req, resp) + }); + let mut instance = s.clone(); + builder = builder.add_unary_handler(&METHOD_AGENT_SERVICE_UPDATE_ROUTES, move |ctx, req, resp| { + instance.update_routes(ctx, req, resp) + }); + let mut instance = s.clone(); + builder = builder.add_unary_handler(&METHOD_AGENT_SERVICE_LIST_INTERFACES, move |ctx, req, resp| { + instance.list_interfaces(ctx, req, resp) + }); + let mut instance = s.clone(); + builder = builder.add_unary_handler(&METHOD_AGENT_SERVICE_LIST_ROUTES, move |ctx, req, resp| { + instance.list_routes(ctx, req, resp) + }); + let mut instance = s.clone(); + builder = builder.add_unary_handler(&METHOD_AGENT_SERVICE_START_TRACING, move |ctx, req, resp| { + instance.start_tracing(ctx, req, resp) + }); + let mut instance = s.clone(); + builder = builder.add_unary_handler(&METHOD_AGENT_SERVICE_STOP_TRACING, move |ctx, req, resp| { + instance.stop_tracing(ctx, req, resp) + }); + let mut instance = s.clone(); + builder = builder.add_unary_handler(&METHOD_AGENT_SERVICE_CREATE_SANDBOX, move |ctx, req, resp| { + instance.create_sandbox(ctx, req, resp) + }); + let mut instance = s.clone(); + builder = builder.add_unary_handler(&METHOD_AGENT_SERVICE_DESTROY_SANDBOX, move |ctx, req, resp| { + instance.destroy_sandbox(ctx, req, resp) + }); + let mut instance = s.clone(); + builder = builder.add_unary_handler(&METHOD_AGENT_SERVICE_ONLINE_CPU_MEM, move |ctx, req, resp| { + instance.online_cpu_mem(ctx, req, resp) + }); + let mut instance = s.clone(); + builder = builder.add_unary_handler(&METHOD_AGENT_SERVICE_RESEED_RANDOM_DEV, move |ctx, req, resp| { + instance.reseed_random_dev(ctx, req, resp) + }); + let mut instance = s.clone(); + builder = builder.add_unary_handler(&METHOD_AGENT_SERVICE_GET_GUEST_DETAILS, move |ctx, req, resp| { + instance.get_guest_details(ctx, req, resp) + }); + let mut instance = s.clone(); + builder = builder.add_unary_handler(&METHOD_AGENT_SERVICE_MEM_HOTPLUG_BY_PROBE, move |ctx, req, resp| { + instance.mem_hotplug_by_probe(ctx, req, resp) + }); + let mut instance = s.clone(); + builder = builder.add_unary_handler(&METHOD_AGENT_SERVICE_SET_GUEST_DATE_TIME, move |ctx, req, resp| { + instance.set_guest_date_time(ctx, req, resp) + }); + let mut instance = s.clone(); + builder = builder.add_unary_handler(&METHOD_AGENT_SERVICE_COPY_FILE, move |ctx, req, resp| { + instance.copy_file(ctx, req, resp) + }); + builder.build() +} diff --git a/src/agent/protocols/src/empty.rs b/src/agent/protocols/src/empty.rs new file mode 100644 index 0000000000..c3d132838e --- /dev/null +++ b/src/agent/protocols/src/empty.rs @@ -0,0 +1,221 @@ +// This file is generated by rust-protobuf 2.6.2. Do not edit +// @generated + +// https://github.com/Manishearth/rust-clippy/issues/702 +#![allow(unknown_lints)] +#![allow(clippy)] + +#![cfg_attr(rustfmt, rustfmt_skip)] + +#![allow(box_pointers)] +#![allow(dead_code)] +#![allow(missing_docs)] +#![allow(non_camel_case_types)] +#![allow(non_snake_case)] +#![allow(non_upper_case_globals)] +#![allow(trivial_casts)] +#![allow(unsafe_code)] +#![allow(unused_imports)] +#![allow(unused_results)] + +use protobuf::Message as Message_imported_for_functions; +use protobuf::ProtobufEnum as ProtobufEnum_imported_for_functions; + +#[derive(PartialEq,Clone,Default)] +pub struct Empty { + // special fields + pub unknown_fields: ::protobuf::UnknownFields, + pub cached_size: ::protobuf::CachedSize, +} + +impl<'a> ::std::default::Default for &'a Empty { + fn default() -> &'a Empty { + ::default_instance() + } +} + +impl Empty { + pub fn new() -> Empty { + ::std::default::Default::default() + } +} + +impl ::protobuf::Message for Empty { + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> Empty { + Empty::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let fields = ::std::vec::Vec::new(); + ::protobuf::reflect::MessageDescriptor::new::( + "Empty", + fields, + file_descriptor_proto() + ) + }) + } + } + + fn default_instance() -> &'static Empty { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const Empty, + }; + unsafe { + instance.get(Empty::new) + } + } +} + +impl ::protobuf::Clear for Empty { + fn clear(&mut self) { + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for Empty { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for Empty { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +static file_descriptor_proto_data: &'static [u8] = b"\ + \n\x1bgoogle/protobuf/empty.proto\x12\x0fgoogle.protobuf\"\x07\n\x05Empt\ + yBT\n\x13com.google.protobufB\nEmptyProtoP\x01Z\x05types\xf8\x01\x01\xa2\ + \x02\x03GPB\xaa\x02\x1eGoogle.Protobuf.WellKnownTypesJ\xfe\x10\n\x06\x12\ + \x04\x1e\03\x10\n\xcc\x0c\n\x01\x0c\x12\x03\x1e\0\x122\xc1\x0c\x20Protoc\ + ol\x20Buffers\x20-\x20Google's\x20data\x20interchange\x20format\n\x20Cop\ + yright\x202008\x20Google\x20Inc.\x20\x20All\x20rights\x20reserved.\n\x20\ + https://developers.google.com/protocol-buffers/\n\n\x20Redistribution\ + \x20and\x20use\x20in\x20source\x20and\x20binary\x20forms,\x20with\x20or\ + \x20without\n\x20modification,\x20are\x20permitted\x20provided\x20that\ + \x20the\x20following\x20conditions\x20are\n\x20met:\n\n\x20\x20\x20\x20\ + \x20*\x20Redistributions\x20of\x20source\x20code\x20must\x20retain\x20th\ + e\x20above\x20copyright\n\x20notice,\x20this\x20list\x20of\x20conditions\ + \x20and\x20the\x20following\x20disclaimer.\n\x20\x20\x20\x20\x20*\x20Red\ + istributions\x20in\x20binary\x20form\x20must\x20reproduce\x20the\x20abov\ + e\n\x20copyright\x20notice,\x20this\x20list\x20of\x20conditions\x20and\ + \x20the\x20following\x20disclaimer\n\x20in\x20the\x20documentation\x20an\ + d/or\x20other\x20materials\x20provided\x20with\x20the\n\x20distribution.\ + \n\x20\x20\x20\x20\x20*\x20Neither\x20the\x20name\x20of\x20Google\x20Inc\ + .\x20nor\x20the\x20names\x20of\x20its\n\x20contributors\x20may\x20be\x20\ + used\x20to\x20endorse\x20or\x20promote\x20products\x20derived\x20from\n\ + \x20this\x20software\x20without\x20specific\x20prior\x20written\x20permi\ + ssion.\n\n\x20THIS\x20SOFTWARE\x20IS\x20PROVIDED\x20BY\x20THE\x20COPYRIG\ + HT\x20HOLDERS\x20AND\x20CONTRIBUTORS\n\x20\"AS\x20IS\"\x20AND\x20ANY\x20\ + EXPRESS\x20OR\x20IMPLIED\x20WARRANTIES,\x20INCLUDING,\x20BUT\x20NOT\n\ + \x20LIMITED\x20TO,\x20THE\x20IMPLIED\x20WARRANTIES\x20OF\x20MERCHANTABIL\ + ITY\x20AND\x20FITNESS\x20FOR\n\x20A\x20PARTICULAR\x20PURPOSE\x20ARE\x20D\ + ISCLAIMED.\x20IN\x20NO\x20EVENT\x20SHALL\x20THE\x20COPYRIGHT\n\x20OWNER\ + \x20OR\x20CONTRIBUTORS\x20BE\x20LIABLE\x20FOR\x20ANY\x20DIRECT,\x20INDIR\ + ECT,\x20INCIDENTAL,\n\x20SPECIAL,\x20EXEMPLARY,\x20OR\x20CONSEQUENTIAL\ + \x20DAMAGES\x20(INCLUDING,\x20BUT\x20NOT\n\x20LIMITED\x20TO,\x20PROCUREM\ + ENT\x20OF\x20SUBSTITUTE\x20GOODS\x20OR\x20SERVICES;\x20LOSS\x20OF\x20USE\ + ,\n\x20DATA,\x20OR\x20PROFITS;\x20OR\x20BUSINESS\x20INTERRUPTION)\x20HOW\ + EVER\x20CAUSED\x20AND\x20ON\x20ANY\n\x20THEORY\x20OF\x20LIABILITY,\x20WH\ + ETHER\x20IN\x20CONTRACT,\x20STRICT\x20LIABILITY,\x20OR\x20TORT\n\x20(INC\ + LUDING\x20NEGLIGENCE\x20OR\x20OTHERWISE)\x20ARISING\x20IN\x20ANY\x20WAY\ + \x20OUT\x20OF\x20THE\x20USE\n\x20OF\x20THIS\x20SOFTWARE,\x20EVEN\x20IF\ + \x20ADVISED\x20OF\x20THE\x20POSSIBILITY\x20OF\x20SUCH\x20DAMAGE.\n\n\x08\ + \n\x01\x02\x12\x03\x20\0\x18\n\x08\n\x01\x08\x12\x03\"\0;\n\t\n\x02\x08%\ + \x12\x03\"\0;\n\x08\n\x01\x08\x12\x03#\0\x1c\n\t\n\x02\x08\x0b\x12\x03#\ + \0\x1c\n\x08\n\x01\x08\x12\x03$\0,\n\t\n\x02\x08\x01\x12\x03$\0,\n\x08\n\ + \x01\x08\x12\x03%\0+\n\t\n\x02\x08\x08\x12\x03%\0+\n\x08\n\x01\x08\x12\ + \x03&\0\"\n\t\n\x02\x08\n\x12\x03&\0\"\n\x08\n\x01\x08\x12\x03'\0!\n\t\n\ + \x02\x08$\x12\x03'\0!\n\x08\n\x01\x08\x12\x03(\0\x1f\n\t\n\x02\x08\x1f\ + \x12\x03(\0\x1f\n\xfb\x02\n\x02\x04\0\x12\x033\0\x10\x1a\xef\x02\x20A\ + \x20generic\x20empty\x20message\x20that\x20you\x20can\x20re-use\x20to\ + \x20avoid\x20defining\x20duplicated\n\x20empty\x20messages\x20in\x20your\ + \x20APIs.\x20A\x20typical\x20example\x20is\x20to\x20use\x20it\x20as\x20t\ + he\x20request\n\x20or\x20the\x20response\x20type\x20of\x20an\x20API\x20m\ + ethod.\x20For\x20instance:\n\n\x20\x20\x20\x20\x20service\x20Foo\x20{\n\ + \x20\x20\x20\x20\x20\x20\x20rpc\x20Bar(google.protobuf.Empty)\x20returns\ + \x20(google.protobuf.Empty);\n\x20\x20\x20\x20\x20}\n\n\x20The\x20JSON\ + \x20representation\x20for\x20`Empty`\x20is\x20empty\x20JSON\x20object\ + \x20`{}`.\n\n\n\n\x03\x04\0\x01\x12\x033\x08\rb\x06proto3\ +"; + +static mut file_descriptor_proto_lazy: ::protobuf::lazy::Lazy<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::descriptor::FileDescriptorProto, +}; + +fn parse_descriptor_proto() -> ::protobuf::descriptor::FileDescriptorProto { + ::protobuf::parse_from_bytes(file_descriptor_proto_data).unwrap() +} + +pub fn file_descriptor_proto() -> &'static ::protobuf::descriptor::FileDescriptorProto { + unsafe { + file_descriptor_proto_lazy.get(|| { + parse_descriptor_proto() + }) + } +} diff --git a/src/agent/protocols/src/health.rs b/src/agent/protocols/src/health.rs new file mode 100644 index 0000000000..066cbe5ce2 --- /dev/null +++ b/src/agent/protocols/src/health.rs @@ -0,0 +1,688 @@ +// This file is generated by rust-protobuf 2.6.2. Do not edit +// @generated + +// https://github.com/Manishearth/rust-clippy/issues/702 +#![allow(unknown_lints)] +#![allow(clippy)] + +#![cfg_attr(rustfmt, rustfmt_skip)] + +#![allow(box_pointers)] +#![allow(dead_code)] +#![allow(missing_docs)] +#![allow(non_camel_case_types)] +#![allow(non_snake_case)] +#![allow(non_upper_case_globals)] +#![allow(trivial_casts)] +#![allow(unsafe_code)] +#![allow(unused_imports)] +#![allow(unused_results)] + +use protobuf::Message as Message_imported_for_functions; +use protobuf::ProtobufEnum as ProtobufEnum_imported_for_functions; + +#[derive(PartialEq,Clone,Default)] +pub struct CheckRequest { + // message fields + pub service: ::std::string::String, + // special fields + pub unknown_fields: ::protobuf::UnknownFields, + pub cached_size: ::protobuf::CachedSize, +} + +impl<'a> ::std::default::Default for &'a CheckRequest { + fn default() -> &'a CheckRequest { + ::default_instance() + } +} + +impl CheckRequest { + pub fn new() -> CheckRequest { + ::std::default::Default::default() + } + + // string service = 1; + + + pub fn get_service(&self) -> &str { + &self.service + } + pub fn clear_service(&mut self) { + self.service.clear(); + } + + // Param is passed by value, moved + pub fn set_service(&mut self, v: ::std::string::String) { + self.service = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_service(&mut self) -> &mut ::std::string::String { + &mut self.service + } + + // Take field + pub fn take_service(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.service, ::std::string::String::new()) + } +} + +impl ::protobuf::Message for CheckRequest { + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.service)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if !self.service.is_empty() { + my_size += ::protobuf::rt::string_size(1, &self.service); + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if !self.service.is_empty() { + os.write_string(1, &self.service)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> CheckRequest { + CheckRequest::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "service", + |m: &CheckRequest| { &m.service }, + |m: &mut CheckRequest| { &mut m.service }, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "CheckRequest", + fields, + file_descriptor_proto() + ) + }) + } + } + + fn default_instance() -> &'static CheckRequest { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const CheckRequest, + }; + unsafe { + instance.get(CheckRequest::new) + } + } +} + +impl ::protobuf::Clear for CheckRequest { + fn clear(&mut self) { + self.service.clear(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for CheckRequest { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for CheckRequest { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct HealthCheckResponse { + // message fields + pub status: HealthCheckResponse_ServingStatus, + // special fields + pub unknown_fields: ::protobuf::UnknownFields, + pub cached_size: ::protobuf::CachedSize, +} + +impl<'a> ::std::default::Default for &'a HealthCheckResponse { + fn default() -> &'a HealthCheckResponse { + ::default_instance() + } +} + +impl HealthCheckResponse { + pub fn new() -> HealthCheckResponse { + ::std::default::Default::default() + } + + // .grpc.HealthCheckResponse.ServingStatus status = 1; + + + pub fn get_status(&self) -> HealthCheckResponse_ServingStatus { + self.status + } + pub fn clear_status(&mut self) { + self.status = HealthCheckResponse_ServingStatus::UNKNOWN; + } + + // Param is passed by value, moved + pub fn set_status(&mut self, v: HealthCheckResponse_ServingStatus) { + self.status = v; + } +} + +impl ::protobuf::Message for HealthCheckResponse { + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_proto3_enum_with_unknown_fields_into(wire_type, is, &mut self.status, 1, &mut self.unknown_fields)? + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if self.status != HealthCheckResponse_ServingStatus::UNKNOWN { + my_size += ::protobuf::rt::enum_size(1, self.status); + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if self.status != HealthCheckResponse_ServingStatus::UNKNOWN { + os.write_enum(1, self.status.value())?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> HealthCheckResponse { + HealthCheckResponse::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeEnum>( + "status", + |m: &HealthCheckResponse| { &m.status }, + |m: &mut HealthCheckResponse| { &mut m.status }, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "HealthCheckResponse", + fields, + file_descriptor_proto() + ) + }) + } + } + + fn default_instance() -> &'static HealthCheckResponse { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const HealthCheckResponse, + }; + unsafe { + instance.get(HealthCheckResponse::new) + } + } +} + +impl ::protobuf::Clear for HealthCheckResponse { + fn clear(&mut self) { + self.status = HealthCheckResponse_ServingStatus::UNKNOWN; + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for HealthCheckResponse { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for HealthCheckResponse { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(Clone,PartialEq,Eq,Debug,Hash)] +pub enum HealthCheckResponse_ServingStatus { + UNKNOWN = 0, + SERVING = 1, + NOT_SERVING = 2, +} + +impl ::protobuf::ProtobufEnum for HealthCheckResponse_ServingStatus { + fn value(&self) -> i32 { + *self as i32 + } + + fn from_i32(value: i32) -> ::std::option::Option { + match value { + 0 => ::std::option::Option::Some(HealthCheckResponse_ServingStatus::UNKNOWN), + 1 => ::std::option::Option::Some(HealthCheckResponse_ServingStatus::SERVING), + 2 => ::std::option::Option::Some(HealthCheckResponse_ServingStatus::NOT_SERVING), + _ => ::std::option::Option::None + } + } + + fn values() -> &'static [Self] { + static values: &'static [HealthCheckResponse_ServingStatus] = &[ + HealthCheckResponse_ServingStatus::UNKNOWN, + HealthCheckResponse_ServingStatus::SERVING, + HealthCheckResponse_ServingStatus::NOT_SERVING, + ]; + values + } + + fn enum_descriptor_static() -> &'static ::protobuf::reflect::EnumDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::EnumDescriptor, + }; + unsafe { + descriptor.get(|| { + ::protobuf::reflect::EnumDescriptor::new("HealthCheckResponse_ServingStatus", file_descriptor_proto()) + }) + } + } +} + +impl ::std::marker::Copy for HealthCheckResponse_ServingStatus { +} + +impl ::std::default::Default for HealthCheckResponse_ServingStatus { + fn default() -> Self { + HealthCheckResponse_ServingStatus::UNKNOWN + } +} + +impl ::protobuf::reflect::ProtobufValue for HealthCheckResponse_ServingStatus { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Enum(self.descriptor()) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct VersionCheckResponse { + // message fields + pub grpc_version: ::std::string::String, + pub agent_version: ::std::string::String, + // special fields + pub unknown_fields: ::protobuf::UnknownFields, + pub cached_size: ::protobuf::CachedSize, +} + +impl<'a> ::std::default::Default for &'a VersionCheckResponse { + fn default() -> &'a VersionCheckResponse { + ::default_instance() + } +} + +impl VersionCheckResponse { + pub fn new() -> VersionCheckResponse { + ::std::default::Default::default() + } + + // string grpc_version = 1; + + + pub fn get_grpc_version(&self) -> &str { + &self.grpc_version + } + pub fn clear_grpc_version(&mut self) { + self.grpc_version.clear(); + } + + // Param is passed by value, moved + pub fn set_grpc_version(&mut self, v: ::std::string::String) { + self.grpc_version = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_grpc_version(&mut self) -> &mut ::std::string::String { + &mut self.grpc_version + } + + // Take field + pub fn take_grpc_version(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.grpc_version, ::std::string::String::new()) + } + + // string agent_version = 2; + + + pub fn get_agent_version(&self) -> &str { + &self.agent_version + } + pub fn clear_agent_version(&mut self) { + self.agent_version.clear(); + } + + // Param is passed by value, moved + pub fn set_agent_version(&mut self, v: ::std::string::String) { + self.agent_version = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_agent_version(&mut self) -> &mut ::std::string::String { + &mut self.agent_version + } + + // Take field + pub fn take_agent_version(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.agent_version, ::std::string::String::new()) + } +} + +impl ::protobuf::Message for VersionCheckResponse { + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.grpc_version)?; + }, + 2 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.agent_version)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if !self.grpc_version.is_empty() { + my_size += ::protobuf::rt::string_size(1, &self.grpc_version); + } + if !self.agent_version.is_empty() { + my_size += ::protobuf::rt::string_size(2, &self.agent_version); + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if !self.grpc_version.is_empty() { + os.write_string(1, &self.grpc_version)?; + } + if !self.agent_version.is_empty() { + os.write_string(2, &self.agent_version)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> VersionCheckResponse { + VersionCheckResponse::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "grpc_version", + |m: &VersionCheckResponse| { &m.grpc_version }, + |m: &mut VersionCheckResponse| { &mut m.grpc_version }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "agent_version", + |m: &VersionCheckResponse| { &m.agent_version }, + |m: &mut VersionCheckResponse| { &mut m.agent_version }, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "VersionCheckResponse", + fields, + file_descriptor_proto() + ) + }) + } + } + + fn default_instance() -> &'static VersionCheckResponse { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const VersionCheckResponse, + }; + unsafe { + instance.get(VersionCheckResponse::new) + } + } +} + +impl ::protobuf::Clear for VersionCheckResponse { + fn clear(&mut self) { + self.grpc_version.clear(); + self.agent_version.clear(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for VersionCheckResponse { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for VersionCheckResponse { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +static file_descriptor_proto_data: &'static [u8] = b"\ + \n\x0chealth.proto\x12\x04grpc\x1a-github.com/gogo/protobuf/gogoproto/go\ + go.proto\"(\n\x0cCheckRequest\x12\x18\n\x07service\x18\x01\x20\x01(\tR\ + \x07service\"\x92\x01\n\x13HealthCheckResponse\x12?\n\x06status\x18\x01\ + \x20\x01(\x0e2'.grpc.HealthCheckResponse.ServingStatusR\x06status\":\n\r\ + ServingStatus\x12\x0b\n\x07UNKNOWN\x10\0\x12\x0b\n\x07SERVING\x10\x01\ + \x12\x0f\n\x0bNOT_SERVING\x10\x02\"^\n\x14VersionCheckResponse\x12!\n\ + \x0cgrpc_version\x18\x01\x20\x01(\tR\x0bgrpcVersion\x12#\n\ragent_versio\ + n\x18\x02\x20\x01(\tR\x0cagentVersion2{\n\x06Health\x126\n\x05Check\x12\ + \x12.grpc.CheckRequest\x1a\x19.grpc.HealthCheckResponse\x129\n\x07Versio\ + n\x12\x12.grpc.CheckRequest\x1a\x1a.grpc.VersionCheckResponseB\x10\xb8\ + \xe2\x1e\x01\xf8\xe1\x1e\x01\xa8\xe2\x1e\x01\xc0\xe2\x1e\x01J\xd9\x06\n\ + \x06\x12\x04\x06\0&\x01\nO\n\x01\x0c\x12\x03\x06\0\x122E\n\x20Copyright\ + \x202017\x20HyperHQ\x20Inc.\n\n\x20SPDX-License-Identifier:\x20Apache-2.\ + 0\n\n\n\x08\n\x01\x02\x12\x03\x08\0\r\n\t\n\x02\x03\0\x12\x03\n\07\n\x08\ + \n\x01\x08\x12\x03\x0c\0$\n\x0b\n\x04\x08\xa5\xec\x03\x12\x03\x0c\0$\n\ + \x08\n\x01\x08\x12\x03\r\0'\n\x0b\n\x04\x08\x9f\xec\x03\x12\x03\r\0'\n\ + \x08\n\x01\x08\x12\x03\x0e\0&\n\x0b\n\x04\x08\xa7\xec\x03\x12\x03\x0e\0&\ + \n\x08\n\x01\x08\x12\x03\x0f\0'\n\x0b\n\x04\x08\xa8\xec\x03\x12\x03\x0f\ + \0'\n\n\n\x02\x04\0\x12\x04\x11\0\x13\x01\n\n\n\x03\x04\0\x01\x12\x03\ + \x11\x08\x14\n\x0b\n\x04\x04\0\x02\0\x12\x03\x12\x08\x1b\n\r\n\x05\x04\0\ + \x02\0\x04\x12\x04\x12\x08\x11\x16\n\x0c\n\x05\x04\0\x02\0\x05\x12\x03\ + \x12\x08\x0e\n\x0c\n\x05\x04\0\x02\0\x01\x12\x03\x12\x0f\x16\n\x0c\n\x05\ + \x04\0\x02\0\x03\x12\x03\x12\x19\x1a\n\n\n\x02\x04\x01\x12\x04\x15\0\x1c\ + \x01\n\n\n\x03\x04\x01\x01\x12\x03\x15\x08\x1b\n\x0c\n\x04\x04\x01\x04\0\ + \x12\x04\x16\x08\x1a\t\n\x0c\n\x05\x04\x01\x04\0\x01\x12\x03\x16\r\x1a\n\ + \r\n\x06\x04\x01\x04\0\x02\0\x12\x03\x17\x10\x1c\n\x0e\n\x07\x04\x01\x04\ + \0\x02\0\x01\x12\x03\x17\x10\x17\n\x0e\n\x07\x04\x01\x04\0\x02\0\x02\x12\ + \x03\x17\x1a\x1b\n\r\n\x06\x04\x01\x04\0\x02\x01\x12\x03\x18\x10\x1c\n\ + \x0e\n\x07\x04\x01\x04\0\x02\x01\x01\x12\x03\x18\x10\x17\n\x0e\n\x07\x04\ + \x01\x04\0\x02\x01\x02\x12\x03\x18\x1a\x1b\n\r\n\x06\x04\x01\x04\0\x02\ + \x02\x12\x03\x19\x10\x20\n\x0e\n\x07\x04\x01\x04\0\x02\x02\x01\x12\x03\ + \x19\x10\x1b\n\x0e\n\x07\x04\x01\x04\0\x02\x02\x02\x12\x03\x19\x1e\x1f\n\ + \x0b\n\x04\x04\x01\x02\0\x12\x03\x1b\x08!\n\r\n\x05\x04\x01\x02\0\x04\ + \x12\x04\x1b\x08\x1a\t\n\x0c\n\x05\x04\x01\x02\0\x06\x12\x03\x1b\x08\x15\ + \n\x0c\n\x05\x04\x01\x02\0\x01\x12\x03\x1b\x16\x1c\n\x0c\n\x05\x04\x01\ + \x02\0\x03\x12\x03\x1b\x1f\x20\n\n\n\x02\x04\x02\x12\x04\x1e\0!\x01\n\n\ + \n\x03\x04\x02\x01\x12\x03\x1e\x08\x1c\n\x0b\n\x04\x04\x02\x02\0\x12\x03\ + \x1f\x08\x20\n\r\n\x05\x04\x02\x02\0\x04\x12\x04\x1f\x08\x1e\x1e\n\x0c\n\ + \x05\x04\x02\x02\0\x05\x12\x03\x1f\x08\x0e\n\x0c\n\x05\x04\x02\x02\0\x01\ + \x12\x03\x1f\x0f\x1b\n\x0c\n\x05\x04\x02\x02\0\x03\x12\x03\x1f\x1e\x1f\n\ + \x0b\n\x04\x04\x02\x02\x01\x12\x03\x20\x08!\n\r\n\x05\x04\x02\x02\x01\ + \x04\x12\x04\x20\x08\x1f\x20\n\x0c\n\x05\x04\x02\x02\x01\x05\x12\x03\x20\ + \x08\x0e\n\x0c\n\x05\x04\x02\x02\x01\x01\x12\x03\x20\x0f\x1c\n\x0c\n\x05\ + \x04\x02\x02\x01\x03\x12\x03\x20\x1f\x20\n\n\n\x02\x06\0\x12\x04#\0&\x01\ + \n\n\n\x03\x06\0\x01\x12\x03#\x08\x0e\n\x0b\n\x04\x06\0\x02\0\x12\x03$\ + \x08>\n\x0c\n\x05\x06\0\x02\0\x01\x12\x03$\x0c\x11\n\x0c\n\x05\x06\0\x02\ + \0\x02\x12\x03$\x12\x1e\n\x0c\n\x05\x06\0\x02\0\x03\x12\x03$)<\n\x0b\n\ + \x04\x06\0\x02\x01\x12\x03%\x08A\n\x0c\n\x05\x06\0\x02\x01\x01\x12\x03%\ + \x0c\x13\n\x0c\n\x05\x06\0\x02\x01\x02\x12\x03%\x14\x20\n\x0c\n\x05\x06\ + \0\x02\x01\x03\x12\x03%+?b\x06proto3\ +"; + +static mut file_descriptor_proto_lazy: ::protobuf::lazy::Lazy<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::descriptor::FileDescriptorProto, +}; + +fn parse_descriptor_proto() -> ::protobuf::descriptor::FileDescriptorProto { + ::protobuf::parse_from_bytes(file_descriptor_proto_data).unwrap() +} + +pub fn file_descriptor_proto() -> &'static ::protobuf::descriptor::FileDescriptorProto { + unsafe { + file_descriptor_proto_lazy.get(|| { + parse_descriptor_proto() + }) + } +} diff --git a/src/agent/protocols/src/health_grpc.rs b/src/agent/protocols/src/health_grpc.rs new file mode 100644 index 0000000000..09e5a5b45c --- /dev/null +++ b/src/agent/protocols/src/health_grpc.rs @@ -0,0 +1,99 @@ +// This file is generated. Do not edit +// @generated + +// https://github.com/Manishearth/rust-clippy/issues/702 +#![allow(unknown_lints)] +#![allow(clippy)] + +#![cfg_attr(rustfmt, rustfmt_skip)] + +#![allow(box_pointers)] +#![allow(dead_code)] +#![allow(missing_docs)] +#![allow(non_camel_case_types)] +#![allow(non_snake_case)] +#![allow(non_upper_case_globals)] +#![allow(trivial_casts)] +#![allow(unsafe_code)] +#![allow(unused_imports)] +#![allow(unused_results)] + +const METHOD_HEALTH_CHECK: ::grpcio::Method = ::grpcio::Method { + ty: ::grpcio::MethodType::Unary, + name: "/grpc.Health/Check", + req_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, + resp_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, +}; + +const METHOD_HEALTH_VERSION: ::grpcio::Method = ::grpcio::Method { + ty: ::grpcio::MethodType::Unary, + name: "/grpc.Health/Version", + req_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, + resp_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de }, +}; + +#[derive(Clone)] +pub struct HealthClient { + client: ::grpcio::Client, +} + +impl HealthClient { + pub fn new(channel: ::grpcio::Channel) -> Self { + HealthClient { + client: ::grpcio::Client::new(channel), + } + } + + pub fn check_opt(&self, req: &super::health::CheckRequest, opt: ::grpcio::CallOption) -> ::grpcio::Result { + self.client.unary_call(&METHOD_HEALTH_CHECK, req, opt) + } + + pub fn check(&self, req: &super::health::CheckRequest) -> ::grpcio::Result { + self.check_opt(req, ::grpcio::CallOption::default()) + } + + pub fn check_async_opt(&self, req: &super::health::CheckRequest, opt: ::grpcio::CallOption) -> ::grpcio::Result<::grpcio::ClientUnaryReceiver> { + self.client.unary_call_async(&METHOD_HEALTH_CHECK, req, opt) + } + + pub fn check_async(&self, req: &super::health::CheckRequest) -> ::grpcio::Result<::grpcio::ClientUnaryReceiver> { + self.check_async_opt(req, ::grpcio::CallOption::default()) + } + + pub fn version_opt(&self, req: &super::health::CheckRequest, opt: ::grpcio::CallOption) -> ::grpcio::Result { + self.client.unary_call(&METHOD_HEALTH_VERSION, req, opt) + } + + pub fn version(&self, req: &super::health::CheckRequest) -> ::grpcio::Result { + self.version_opt(req, ::grpcio::CallOption::default()) + } + + pub fn version_async_opt(&self, req: &super::health::CheckRequest, opt: ::grpcio::CallOption) -> ::grpcio::Result<::grpcio::ClientUnaryReceiver> { + self.client.unary_call_async(&METHOD_HEALTH_VERSION, req, opt) + } + + pub fn version_async(&self, req: &super::health::CheckRequest) -> ::grpcio::Result<::grpcio::ClientUnaryReceiver> { + self.version_async_opt(req, ::grpcio::CallOption::default()) + } + pub fn spawn(&self, f: F) where F: ::futures::Future + Send + 'static { + self.client.spawn(f) + } +} + +pub trait Health { + fn check(&mut self, ctx: ::grpcio::RpcContext, req: super::health::CheckRequest, sink: ::grpcio::UnarySink); + fn version(&mut self, ctx: ::grpcio::RpcContext, req: super::health::CheckRequest, sink: ::grpcio::UnarySink); +} + +pub fn create_health(s: S) -> ::grpcio::Service { + let mut builder = ::grpcio::ServiceBuilder::new(); + let mut instance = s.clone(); + builder = builder.add_unary_handler(&METHOD_HEALTH_CHECK, move |ctx, req, resp| { + instance.check(ctx, req, resp) + }); + let mut instance = s.clone(); + builder = builder.add_unary_handler(&METHOD_HEALTH_VERSION, move |ctx, req, resp| { + instance.version(ctx, req, resp) + }); + builder.build() +} diff --git a/src/agent/protocols/src/lib.rs b/src/agent/protocols/src/lib.rs new file mode 100644 index 0000000000..63897aec4f --- /dev/null +++ b/src/agent/protocols/src/lib.rs @@ -0,0 +1,17 @@ +#![allow(bare_trait_objects)] + +pub mod agent; +pub mod agent_grpc; +pub mod health; +pub mod health_grpc; +pub mod oci; +pub mod types; +pub mod empty; + +#[cfg(test)] +mod tests { + #[test] + fn it_works() { + assert_eq!(2 + 2, 4); + } +} diff --git a/src/agent/protocols/src/oci.rs b/src/agent/protocols/src/oci.rs new file mode 100644 index 0000000000..f6251a9448 --- /dev/null +++ b/src/agent/protocols/src/oci.rs @@ -0,0 +1,10473 @@ +// This file is generated by rust-protobuf 2.6.2. Do not edit +// @generated + +// https://github.com/Manishearth/rust-clippy/issues/702 +#![allow(unknown_lints)] +#![allow(clippy)] + +#![cfg_attr(rustfmt, rustfmt_skip)] + +#![allow(box_pointers)] +#![allow(dead_code)] +#![allow(missing_docs)] +#![allow(non_camel_case_types)] +#![allow(non_snake_case)] +#![allow(non_upper_case_globals)] +#![allow(trivial_casts)] +#![allow(unsafe_code)] +#![allow(unused_imports)] +#![allow(unused_results)] + +use protobuf::Message as Message_imported_for_functions; +use protobuf::ProtobufEnum as ProtobufEnum_imported_for_functions; + +#[derive(PartialEq,Clone,Default)] +pub struct Spec { + // message fields + pub Version: ::std::string::String, + pub Process: ::protobuf::SingularPtrField, + pub Root: ::protobuf::SingularPtrField, + pub Hostname: ::std::string::String, + pub Mounts: ::protobuf::RepeatedField, + pub Hooks: ::protobuf::SingularPtrField, + pub Annotations: ::std::collections::HashMap<::std::string::String, ::std::string::String>, + pub Linux: ::protobuf::SingularPtrField, + pub Solaris: ::protobuf::SingularPtrField, + pub Windows: ::protobuf::SingularPtrField, + // special fields + pub unknown_fields: ::protobuf::UnknownFields, + pub cached_size: ::protobuf::CachedSize, +} + +impl<'a> ::std::default::Default for &'a Spec { + fn default() -> &'a Spec { + ::default_instance() + } +} + +impl Spec { + pub fn new() -> Spec { + ::std::default::Default::default() + } + + // string Version = 1; + + + pub fn get_Version(&self) -> &str { + &self.Version + } + pub fn clear_Version(&mut self) { + self.Version.clear(); + } + + // Param is passed by value, moved + pub fn set_Version(&mut self, v: ::std::string::String) { + self.Version = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_Version(&mut self) -> &mut ::std::string::String { + &mut self.Version + } + + // Take field + pub fn take_Version(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.Version, ::std::string::String::new()) + } + + // .grpc.Process Process = 2; + + + pub fn get_Process(&self) -> &Process { + self.Process.as_ref().unwrap_or_else(|| Process::default_instance()) + } + pub fn clear_Process(&mut self) { + self.Process.clear(); + } + + pub fn has_Process(&self) -> bool { + self.Process.is_some() + } + + // Param is passed by value, moved + pub fn set_Process(&mut self, v: Process) { + self.Process = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_Process(&mut self) -> &mut Process { + if self.Process.is_none() { + self.Process.set_default(); + } + self.Process.as_mut().unwrap() + } + + // Take field + pub fn take_Process(&mut self) -> Process { + self.Process.take().unwrap_or_else(|| Process::new()) + } + + // .grpc.Root Root = 3; + + + pub fn get_Root(&self) -> &Root { + self.Root.as_ref().unwrap_or_else(|| Root::default_instance()) + } + pub fn clear_Root(&mut self) { + self.Root.clear(); + } + + pub fn has_Root(&self) -> bool { + self.Root.is_some() + } + + // Param is passed by value, moved + pub fn set_Root(&mut self, v: Root) { + self.Root = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_Root(&mut self) -> &mut Root { + if self.Root.is_none() { + self.Root.set_default(); + } + self.Root.as_mut().unwrap() + } + + // Take field + pub fn take_Root(&mut self) -> Root { + self.Root.take().unwrap_or_else(|| Root::new()) + } + + // string Hostname = 4; + + + pub fn get_Hostname(&self) -> &str { + &self.Hostname + } + pub fn clear_Hostname(&mut self) { + self.Hostname.clear(); + } + + // Param is passed by value, moved + pub fn set_Hostname(&mut self, v: ::std::string::String) { + self.Hostname = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_Hostname(&mut self) -> &mut ::std::string::String { + &mut self.Hostname + } + + // Take field + pub fn take_Hostname(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.Hostname, ::std::string::String::new()) + } + + // repeated .grpc.Mount Mounts = 5; + + + pub fn get_Mounts(&self) -> &[Mount] { + &self.Mounts + } + pub fn clear_Mounts(&mut self) { + self.Mounts.clear(); + } + + // Param is passed by value, moved + pub fn set_Mounts(&mut self, v: ::protobuf::RepeatedField) { + self.Mounts = v; + } + + // Mutable pointer to the field. + pub fn mut_Mounts(&mut self) -> &mut ::protobuf::RepeatedField { + &mut self.Mounts + } + + // Take field + pub fn take_Mounts(&mut self) -> ::protobuf::RepeatedField { + ::std::mem::replace(&mut self.Mounts, ::protobuf::RepeatedField::new()) + } + + // .grpc.Hooks Hooks = 6; + + + pub fn get_Hooks(&self) -> &Hooks { + self.Hooks.as_ref().unwrap_or_else(|| Hooks::default_instance()) + } + pub fn clear_Hooks(&mut self) { + self.Hooks.clear(); + } + + pub fn has_Hooks(&self) -> bool { + self.Hooks.is_some() + } + + // Param is passed by value, moved + pub fn set_Hooks(&mut self, v: Hooks) { + self.Hooks = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_Hooks(&mut self) -> &mut Hooks { + if self.Hooks.is_none() { + self.Hooks.set_default(); + } + self.Hooks.as_mut().unwrap() + } + + // Take field + pub fn take_Hooks(&mut self) -> Hooks { + self.Hooks.take().unwrap_or_else(|| Hooks::new()) + } + + // repeated .grpc.Spec.AnnotationsEntry Annotations = 7; + + + pub fn get_Annotations(&self) -> &::std::collections::HashMap<::std::string::String, ::std::string::String> { + &self.Annotations + } + pub fn clear_Annotations(&mut self) { + self.Annotations.clear(); + } + + // Param is passed by value, moved + pub fn set_Annotations(&mut self, v: ::std::collections::HashMap<::std::string::String, ::std::string::String>) { + self.Annotations = v; + } + + // Mutable pointer to the field. + pub fn mut_Annotations(&mut self) -> &mut ::std::collections::HashMap<::std::string::String, ::std::string::String> { + &mut self.Annotations + } + + // Take field + pub fn take_Annotations(&mut self) -> ::std::collections::HashMap<::std::string::String, ::std::string::String> { + ::std::mem::replace(&mut self.Annotations, ::std::collections::HashMap::new()) + } + + // .grpc.Linux Linux = 8; + + + pub fn get_Linux(&self) -> &Linux { + self.Linux.as_ref().unwrap_or_else(|| Linux::default_instance()) + } + pub fn clear_Linux(&mut self) { + self.Linux.clear(); + } + + pub fn has_Linux(&self) -> bool { + self.Linux.is_some() + } + + // Param is passed by value, moved + pub fn set_Linux(&mut self, v: Linux) { + self.Linux = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_Linux(&mut self) -> &mut Linux { + if self.Linux.is_none() { + self.Linux.set_default(); + } + self.Linux.as_mut().unwrap() + } + + // Take field + pub fn take_Linux(&mut self) -> Linux { + self.Linux.take().unwrap_or_else(|| Linux::new()) + } + + // .grpc.Solaris Solaris = 9; + + + pub fn get_Solaris(&self) -> &Solaris { + self.Solaris.as_ref().unwrap_or_else(|| Solaris::default_instance()) + } + pub fn clear_Solaris(&mut self) { + self.Solaris.clear(); + } + + pub fn has_Solaris(&self) -> bool { + self.Solaris.is_some() + } + + // Param is passed by value, moved + pub fn set_Solaris(&mut self, v: Solaris) { + self.Solaris = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_Solaris(&mut self) -> &mut Solaris { + if self.Solaris.is_none() { + self.Solaris.set_default(); + } + self.Solaris.as_mut().unwrap() + } + + // Take field + pub fn take_Solaris(&mut self) -> Solaris { + self.Solaris.take().unwrap_or_else(|| Solaris::new()) + } + + // .grpc.Windows Windows = 10; + + + pub fn get_Windows(&self) -> &Windows { + self.Windows.as_ref().unwrap_or_else(|| Windows::default_instance()) + } + pub fn clear_Windows(&mut self) { + self.Windows.clear(); + } + + pub fn has_Windows(&self) -> bool { + self.Windows.is_some() + } + + // Param is passed by value, moved + pub fn set_Windows(&mut self, v: Windows) { + self.Windows = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_Windows(&mut self) -> &mut Windows { + if self.Windows.is_none() { + self.Windows.set_default(); + } + self.Windows.as_mut().unwrap() + } + + // Take field + pub fn take_Windows(&mut self) -> Windows { + self.Windows.take().unwrap_or_else(|| Windows::new()) + } +} + +impl ::protobuf::Message for Spec { + fn is_initialized(&self) -> bool { + for v in &self.Process { + if !v.is_initialized() { + return false; + } + }; + for v in &self.Root { + if !v.is_initialized() { + return false; + } + }; + for v in &self.Mounts { + if !v.is_initialized() { + return false; + } + }; + for v in &self.Hooks { + if !v.is_initialized() { + return false; + } + }; + for v in &self.Linux { + if !v.is_initialized() { + return false; + } + }; + for v in &self.Solaris { + if !v.is_initialized() { + return false; + } + }; + for v in &self.Windows { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.Version)?; + }, + 2 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.Process)?; + }, + 3 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.Root)?; + }, + 4 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.Hostname)?; + }, + 5 => { + ::protobuf::rt::read_repeated_message_into(wire_type, is, &mut self.Mounts)?; + }, + 6 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.Hooks)?; + }, + 7 => { + ::protobuf::rt::read_map_into::<::protobuf::types::ProtobufTypeString, ::protobuf::types::ProtobufTypeString>(wire_type, is, &mut self.Annotations)?; + }, + 8 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.Linux)?; + }, + 9 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.Solaris)?; + }, + 10 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.Windows)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if !self.Version.is_empty() { + my_size += ::protobuf::rt::string_size(1, &self.Version); + } + if let Some(ref v) = self.Process.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + if let Some(ref v) = self.Root.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + if !self.Hostname.is_empty() { + my_size += ::protobuf::rt::string_size(4, &self.Hostname); + } + for value in &self.Mounts { + let len = value.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + }; + if let Some(ref v) = self.Hooks.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + my_size += ::protobuf::rt::compute_map_size::<::protobuf::types::ProtobufTypeString, ::protobuf::types::ProtobufTypeString>(7, &self.Annotations); + if let Some(ref v) = self.Linux.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + if let Some(ref v) = self.Solaris.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + if let Some(ref v) = self.Windows.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if !self.Version.is_empty() { + os.write_string(1, &self.Version)?; + } + if let Some(ref v) = self.Process.as_ref() { + os.write_tag(2, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + if let Some(ref v) = self.Root.as_ref() { + os.write_tag(3, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + if !self.Hostname.is_empty() { + os.write_string(4, &self.Hostname)?; + } + for v in &self.Mounts { + os.write_tag(5, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + }; + if let Some(ref v) = self.Hooks.as_ref() { + os.write_tag(6, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + ::protobuf::rt::write_map_with_cached_sizes::<::protobuf::types::ProtobufTypeString, ::protobuf::types::ProtobufTypeString>(7, &self.Annotations, os)?; + if let Some(ref v) = self.Linux.as_ref() { + os.write_tag(8, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + if let Some(ref v) = self.Solaris.as_ref() { + os.write_tag(9, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + if let Some(ref v) = self.Windows.as_ref() { + os.write_tag(10, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: ::std::boxed::Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> Spec { + Spec::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "Version", + |m: &Spec| { &m.Version }, + |m: &mut Spec| { &mut m.Version }, + )); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "Process", + |m: &Spec| { &m.Process }, + |m: &mut Spec| { &mut m.Process }, + )); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "Root", + |m: &Spec| { &m.Root }, + |m: &mut Spec| { &mut m.Root }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "Hostname", + |m: &Spec| { &m.Hostname }, + |m: &mut Spec| { &mut m.Hostname }, + )); + fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "Mounts", + |m: &Spec| { &m.Mounts }, + |m: &mut Spec| { &mut m.Mounts }, + )); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "Hooks", + |m: &Spec| { &m.Hooks }, + |m: &mut Spec| { &mut m.Hooks }, + )); + fields.push(::protobuf::reflect::accessor::make_map_accessor::<_, ::protobuf::types::ProtobufTypeString, ::protobuf::types::ProtobufTypeString>( + "Annotations", + |m: &Spec| { &m.Annotations }, + |m: &mut Spec| { &mut m.Annotations }, + )); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "Linux", + |m: &Spec| { &m.Linux }, + |m: &mut Spec| { &mut m.Linux }, + )); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "Solaris", + |m: &Spec| { &m.Solaris }, + |m: &mut Spec| { &mut m.Solaris }, + )); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "Windows", + |m: &Spec| { &m.Windows }, + |m: &mut Spec| { &mut m.Windows }, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "Spec", + fields, + file_descriptor_proto() + ) + }) + } + } + + fn default_instance() -> &'static Spec { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const Spec, + }; + unsafe { + instance.get(Spec::new) + } + } +} + +impl ::protobuf::Clear for Spec { + fn clear(&mut self) { + self.Version.clear(); + self.Process.clear(); + self.Root.clear(); + self.Hostname.clear(); + self.Mounts.clear(); + self.Hooks.clear(); + self.Annotations.clear(); + self.Linux.clear(); + self.Solaris.clear(); + self.Windows.clear(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for Spec { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for Spec { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct Process { + // message fields + pub Terminal: bool, + pub ConsoleSize: ::protobuf::SingularPtrField, + pub User: ::protobuf::SingularPtrField, + pub Args: ::protobuf::RepeatedField<::std::string::String>, + pub Env: ::protobuf::RepeatedField<::std::string::String>, + pub Cwd: ::std::string::String, + pub Capabilities: ::protobuf::SingularPtrField, + pub Rlimits: ::protobuf::RepeatedField, + pub NoNewPrivileges: bool, + pub ApparmorProfile: ::std::string::String, + pub OOMScoreAdj: i64, + pub SelinuxLabel: ::std::string::String, + // special fields + pub unknown_fields: ::protobuf::UnknownFields, + pub cached_size: ::protobuf::CachedSize, +} + +impl<'a> ::std::default::Default for &'a Process { + fn default() -> &'a Process { + ::default_instance() + } +} + +impl Process { + pub fn new() -> Process { + ::std::default::Default::default() + } + + // bool Terminal = 1; + + + pub fn get_Terminal(&self) -> bool { + self.Terminal + } + pub fn clear_Terminal(&mut self) { + self.Terminal = false; + } + + // Param is passed by value, moved + pub fn set_Terminal(&mut self, v: bool) { + self.Terminal = v; + } + + // .grpc.Box ConsoleSize = 2; + + + pub fn get_ConsoleSize(&self) -> &Box { + self.ConsoleSize.as_ref().unwrap_or_else(|| Box::default_instance()) + } + pub fn clear_ConsoleSize(&mut self) { + self.ConsoleSize.clear(); + } + + pub fn has_ConsoleSize(&self) -> bool { + self.ConsoleSize.is_some() + } + + // Param is passed by value, moved + pub fn set_ConsoleSize(&mut self, v: Box) { + self.ConsoleSize = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_ConsoleSize(&mut self) -> &mut Box { + if self.ConsoleSize.is_none() { + self.ConsoleSize.set_default(); + } + self.ConsoleSize.as_mut().unwrap() + } + + // Take field + pub fn take_ConsoleSize(&mut self) -> Box { + self.ConsoleSize.take().unwrap_or_else(|| Box::new()) + } + + // .grpc.User User = 3; + + + pub fn get_User(&self) -> &User { + self.User.as_ref().unwrap_or_else(|| User::default_instance()) + } + pub fn clear_User(&mut self) { + self.User.clear(); + } + + pub fn has_User(&self) -> bool { + self.User.is_some() + } + + // Param is passed by value, moved + pub fn set_User(&mut self, v: User) { + self.User = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_User(&mut self) -> &mut User { + if self.User.is_none() { + self.User.set_default(); + } + self.User.as_mut().unwrap() + } + + // Take field + pub fn take_User(&mut self) -> User { + self.User.take().unwrap_or_else(|| User::new()) + } + + // repeated string Args = 4; + + + pub fn get_Args(&self) -> &[::std::string::String] { + &self.Args + } + pub fn clear_Args(&mut self) { + self.Args.clear(); + } + + // Param is passed by value, moved + pub fn set_Args(&mut self, v: ::protobuf::RepeatedField<::std::string::String>) { + self.Args = v; + } + + // Mutable pointer to the field. + pub fn mut_Args(&mut self) -> &mut ::protobuf::RepeatedField<::std::string::String> { + &mut self.Args + } + + // Take field + pub fn take_Args(&mut self) -> ::protobuf::RepeatedField<::std::string::String> { + ::std::mem::replace(&mut self.Args, ::protobuf::RepeatedField::new()) + } + + // repeated string Env = 5; + + + pub fn get_Env(&self) -> &[::std::string::String] { + &self.Env + } + pub fn clear_Env(&mut self) { + self.Env.clear(); + } + + // Param is passed by value, moved + pub fn set_Env(&mut self, v: ::protobuf::RepeatedField<::std::string::String>) { + self.Env = v; + } + + // Mutable pointer to the field. + pub fn mut_Env(&mut self) -> &mut ::protobuf::RepeatedField<::std::string::String> { + &mut self.Env + } + + // Take field + pub fn take_Env(&mut self) -> ::protobuf::RepeatedField<::std::string::String> { + ::std::mem::replace(&mut self.Env, ::protobuf::RepeatedField::new()) + } + + // string Cwd = 6; + + + pub fn get_Cwd(&self) -> &str { + &self.Cwd + } + pub fn clear_Cwd(&mut self) { + self.Cwd.clear(); + } + + // Param is passed by value, moved + pub fn set_Cwd(&mut self, v: ::std::string::String) { + self.Cwd = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_Cwd(&mut self) -> &mut ::std::string::String { + &mut self.Cwd + } + + // Take field + pub fn take_Cwd(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.Cwd, ::std::string::String::new()) + } + + // .grpc.LinuxCapabilities Capabilities = 7; + + + pub fn get_Capabilities(&self) -> &LinuxCapabilities { + self.Capabilities.as_ref().unwrap_or_else(|| LinuxCapabilities::default_instance()) + } + pub fn clear_Capabilities(&mut self) { + self.Capabilities.clear(); + } + + pub fn has_Capabilities(&self) -> bool { + self.Capabilities.is_some() + } + + // Param is passed by value, moved + pub fn set_Capabilities(&mut self, v: LinuxCapabilities) { + self.Capabilities = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_Capabilities(&mut self) -> &mut LinuxCapabilities { + if self.Capabilities.is_none() { + self.Capabilities.set_default(); + } + self.Capabilities.as_mut().unwrap() + } + + // Take field + pub fn take_Capabilities(&mut self) -> LinuxCapabilities { + self.Capabilities.take().unwrap_or_else(|| LinuxCapabilities::new()) + } + + // repeated .grpc.POSIXRlimit Rlimits = 8; + + + pub fn get_Rlimits(&self) -> &[POSIXRlimit] { + &self.Rlimits + } + pub fn clear_Rlimits(&mut self) { + self.Rlimits.clear(); + } + + // Param is passed by value, moved + pub fn set_Rlimits(&mut self, v: ::protobuf::RepeatedField) { + self.Rlimits = v; + } + + // Mutable pointer to the field. + pub fn mut_Rlimits(&mut self) -> &mut ::protobuf::RepeatedField { + &mut self.Rlimits + } + + // Take field + pub fn take_Rlimits(&mut self) -> ::protobuf::RepeatedField { + ::std::mem::replace(&mut self.Rlimits, ::protobuf::RepeatedField::new()) + } + + // bool NoNewPrivileges = 9; + + + pub fn get_NoNewPrivileges(&self) -> bool { + self.NoNewPrivileges + } + pub fn clear_NoNewPrivileges(&mut self) { + self.NoNewPrivileges = false; + } + + // Param is passed by value, moved + pub fn set_NoNewPrivileges(&mut self, v: bool) { + self.NoNewPrivileges = v; + } + + // string ApparmorProfile = 10; + + + pub fn get_ApparmorProfile(&self) -> &str { + &self.ApparmorProfile + } + pub fn clear_ApparmorProfile(&mut self) { + self.ApparmorProfile.clear(); + } + + // Param is passed by value, moved + pub fn set_ApparmorProfile(&mut self, v: ::std::string::String) { + self.ApparmorProfile = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_ApparmorProfile(&mut self) -> &mut ::std::string::String { + &mut self.ApparmorProfile + } + + // Take field + pub fn take_ApparmorProfile(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.ApparmorProfile, ::std::string::String::new()) + } + + // int64 OOMScoreAdj = 11; + + + pub fn get_OOMScoreAdj(&self) -> i64 { + self.OOMScoreAdj + } + pub fn clear_OOMScoreAdj(&mut self) { + self.OOMScoreAdj = 0; + } + + // Param is passed by value, moved + pub fn set_OOMScoreAdj(&mut self, v: i64) { + self.OOMScoreAdj = v; + } + + // string SelinuxLabel = 12; + + + pub fn get_SelinuxLabel(&self) -> &str { + &self.SelinuxLabel + } + pub fn clear_SelinuxLabel(&mut self) { + self.SelinuxLabel.clear(); + } + + // Param is passed by value, moved + pub fn set_SelinuxLabel(&mut self, v: ::std::string::String) { + self.SelinuxLabel = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_SelinuxLabel(&mut self) -> &mut ::std::string::String { + &mut self.SelinuxLabel + } + + // Take field + pub fn take_SelinuxLabel(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.SelinuxLabel, ::std::string::String::new()) + } +} + +impl ::protobuf::Message for Process { + fn is_initialized(&self) -> bool { + for v in &self.ConsoleSize { + if !v.is_initialized() { + return false; + } + }; + for v in &self.User { + if !v.is_initialized() { + return false; + } + }; + for v in &self.Capabilities { + if !v.is_initialized() { + return false; + } + }; + for v in &self.Rlimits { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_bool()?; + self.Terminal = tmp; + }, + 2 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.ConsoleSize)?; + }, + 3 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.User)?; + }, + 4 => { + ::protobuf::rt::read_repeated_string_into(wire_type, is, &mut self.Args)?; + }, + 5 => { + ::protobuf::rt::read_repeated_string_into(wire_type, is, &mut self.Env)?; + }, + 6 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.Cwd)?; + }, + 7 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.Capabilities)?; + }, + 8 => { + ::protobuf::rt::read_repeated_message_into(wire_type, is, &mut self.Rlimits)?; + }, + 9 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_bool()?; + self.NoNewPrivileges = tmp; + }, + 10 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.ApparmorProfile)?; + }, + 11 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_int64()?; + self.OOMScoreAdj = tmp; + }, + 12 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.SelinuxLabel)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if self.Terminal != false { + my_size += 2; + } + if let Some(ref v) = self.ConsoleSize.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + if let Some(ref v) = self.User.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + for value in &self.Args { + my_size += ::protobuf::rt::string_size(4, &value); + }; + for value in &self.Env { + my_size += ::protobuf::rt::string_size(5, &value); + }; + if !self.Cwd.is_empty() { + my_size += ::protobuf::rt::string_size(6, &self.Cwd); + } + if let Some(ref v) = self.Capabilities.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + for value in &self.Rlimits { + let len = value.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + }; + if self.NoNewPrivileges != false { + my_size += 2; + } + if !self.ApparmorProfile.is_empty() { + my_size += ::protobuf::rt::string_size(10, &self.ApparmorProfile); + } + if self.OOMScoreAdj != 0 { + my_size += ::protobuf::rt::value_size(11, self.OOMScoreAdj, ::protobuf::wire_format::WireTypeVarint); + } + if !self.SelinuxLabel.is_empty() { + my_size += ::protobuf::rt::string_size(12, &self.SelinuxLabel); + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if self.Terminal != false { + os.write_bool(1, self.Terminal)?; + } + if let Some(ref v) = self.ConsoleSize.as_ref() { + os.write_tag(2, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + if let Some(ref v) = self.User.as_ref() { + os.write_tag(3, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + for v in &self.Args { + os.write_string(4, &v)?; + }; + for v in &self.Env { + os.write_string(5, &v)?; + }; + if !self.Cwd.is_empty() { + os.write_string(6, &self.Cwd)?; + } + if let Some(ref v) = self.Capabilities.as_ref() { + os.write_tag(7, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + for v in &self.Rlimits { + os.write_tag(8, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + }; + if self.NoNewPrivileges != false { + os.write_bool(9, self.NoNewPrivileges)?; + } + if !self.ApparmorProfile.is_empty() { + os.write_string(10, &self.ApparmorProfile)?; + } + if self.OOMScoreAdj != 0 { + os.write_int64(11, self.OOMScoreAdj)?; + } + if !self.SelinuxLabel.is_empty() { + os.write_string(12, &self.SelinuxLabel)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: ::std::boxed::Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> Process { + Process::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeBool>( + "Terminal", + |m: &Process| { &m.Terminal }, + |m: &mut Process| { &mut m.Terminal }, + )); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "ConsoleSize", + |m: &Process| { &m.ConsoleSize }, + |m: &mut Process| { &mut m.ConsoleSize }, + )); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "User", + |m: &Process| { &m.User }, + |m: &mut Process| { &mut m.User }, + )); + fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "Args", + |m: &Process| { &m.Args }, + |m: &mut Process| { &mut m.Args }, + )); + fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "Env", + |m: &Process| { &m.Env }, + |m: &mut Process| { &mut m.Env }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "Cwd", + |m: &Process| { &m.Cwd }, + |m: &mut Process| { &mut m.Cwd }, + )); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "Capabilities", + |m: &Process| { &m.Capabilities }, + |m: &mut Process| { &mut m.Capabilities }, + )); + fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "Rlimits", + |m: &Process| { &m.Rlimits }, + |m: &mut Process| { &mut m.Rlimits }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeBool>( + "NoNewPrivileges", + |m: &Process| { &m.NoNewPrivileges }, + |m: &mut Process| { &mut m.NoNewPrivileges }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "ApparmorProfile", + |m: &Process| { &m.ApparmorProfile }, + |m: &mut Process| { &mut m.ApparmorProfile }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeInt64>( + "OOMScoreAdj", + |m: &Process| { &m.OOMScoreAdj }, + |m: &mut Process| { &mut m.OOMScoreAdj }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "SelinuxLabel", + |m: &Process| { &m.SelinuxLabel }, + |m: &mut Process| { &mut m.SelinuxLabel }, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "Process", + fields, + file_descriptor_proto() + ) + }) + } + } + + fn default_instance() -> &'static Process { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const Process, + }; + unsafe { + instance.get(Process::new) + } + } +} + +impl ::protobuf::Clear for Process { + fn clear(&mut self) { + self.Terminal = false; + self.ConsoleSize.clear(); + self.User.clear(); + self.Args.clear(); + self.Env.clear(); + self.Cwd.clear(); + self.Capabilities.clear(); + self.Rlimits.clear(); + self.NoNewPrivileges = false; + self.ApparmorProfile.clear(); + self.OOMScoreAdj = 0; + self.SelinuxLabel.clear(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for Process { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for Process { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct Box { + // message fields + pub Height: u32, + pub Width: u32, + // special fields + pub unknown_fields: ::protobuf::UnknownFields, + pub cached_size: ::protobuf::CachedSize, +} + +impl<'a> ::std::default::Default for &'a Box { + fn default() -> &'a Box { + ::default_instance() + } +} + +impl Box { + pub fn new() -> Box { + ::std::default::Default::default() + } + + // uint32 Height = 1; + + + pub fn get_Height(&self) -> u32 { + self.Height + } + pub fn clear_Height(&mut self) { + self.Height = 0; + } + + // Param is passed by value, moved + pub fn set_Height(&mut self, v: u32) { + self.Height = v; + } + + // uint32 Width = 2; + + + pub fn get_Width(&self) -> u32 { + self.Width + } + pub fn clear_Width(&mut self) { + self.Width = 0; + } + + // Param is passed by value, moved + pub fn set_Width(&mut self, v: u32) { + self.Width = v; + } +} + +impl ::protobuf::Message for Box { + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint32()?; + self.Height = tmp; + }, + 2 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint32()?; + self.Width = tmp; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if self.Height != 0 { + my_size += ::protobuf::rt::value_size(1, self.Height, ::protobuf::wire_format::WireTypeVarint); + } + if self.Width != 0 { + my_size += ::protobuf::rt::value_size(2, self.Width, ::protobuf::wire_format::WireTypeVarint); + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if self.Height != 0 { + os.write_uint32(1, self.Height)?; + } + if self.Width != 0 { + os.write_uint32(2, self.Width)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: ::std::boxed::Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> Box { + Box::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint32>( + "Height", + |m: &Box| { &m.Height }, + |m: &mut Box| { &mut m.Height }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint32>( + "Width", + |m: &Box| { &m.Width }, + |m: &mut Box| { &mut m.Width }, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "Box", + fields, + file_descriptor_proto() + ) + }) + } + } + + fn default_instance() -> &'static Box { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const Box, + }; + unsafe { + instance.get(Box::new) + } + } +} + +impl ::protobuf::Clear for Box { + fn clear(&mut self) { + self.Height = 0; + self.Width = 0; + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for Box { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for Box { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct User { + // message fields + pub UID: u32, + pub GID: u32, + pub AdditionalGids: ::std::vec::Vec, + pub Username: ::std::string::String, + // special fields + pub unknown_fields: ::protobuf::UnknownFields, + pub cached_size: ::protobuf::CachedSize, +} + +impl<'a> ::std::default::Default for &'a User { + fn default() -> &'a User { + ::default_instance() + } +} + +impl User { + pub fn new() -> User { + ::std::default::Default::default() + } + + // uint32 UID = 1; + + + pub fn get_UID(&self) -> u32 { + self.UID + } + pub fn clear_UID(&mut self) { + self.UID = 0; + } + + // Param is passed by value, moved + pub fn set_UID(&mut self, v: u32) { + self.UID = v; + } + + // uint32 GID = 2; + + + pub fn get_GID(&self) -> u32 { + self.GID + } + pub fn clear_GID(&mut self) { + self.GID = 0; + } + + // Param is passed by value, moved + pub fn set_GID(&mut self, v: u32) { + self.GID = v; + } + + // repeated uint32 AdditionalGids = 3; + + + pub fn get_AdditionalGids(&self) -> &[u32] { + &self.AdditionalGids + } + pub fn clear_AdditionalGids(&mut self) { + self.AdditionalGids.clear(); + } + + // Param is passed by value, moved + pub fn set_AdditionalGids(&mut self, v: ::std::vec::Vec) { + self.AdditionalGids = v; + } + + // Mutable pointer to the field. + pub fn mut_AdditionalGids(&mut self) -> &mut ::std::vec::Vec { + &mut self.AdditionalGids + } + + // Take field + pub fn take_AdditionalGids(&mut self) -> ::std::vec::Vec { + ::std::mem::replace(&mut self.AdditionalGids, ::std::vec::Vec::new()) + } + + // string Username = 4; + + + pub fn get_Username(&self) -> &str { + &self.Username + } + pub fn clear_Username(&mut self) { + self.Username.clear(); + } + + // Param is passed by value, moved + pub fn set_Username(&mut self, v: ::std::string::String) { + self.Username = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_Username(&mut self) -> &mut ::std::string::String { + &mut self.Username + } + + // Take field + pub fn take_Username(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.Username, ::std::string::String::new()) + } +} + +impl ::protobuf::Message for User { + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint32()?; + self.UID = tmp; + }, + 2 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint32()?; + self.GID = tmp; + }, + 3 => { + ::protobuf::rt::read_repeated_uint32_into(wire_type, is, &mut self.AdditionalGids)?; + }, + 4 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.Username)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if self.UID != 0 { + my_size += ::protobuf::rt::value_size(1, self.UID, ::protobuf::wire_format::WireTypeVarint); + } + if self.GID != 0 { + my_size += ::protobuf::rt::value_size(2, self.GID, ::protobuf::wire_format::WireTypeVarint); + } + for value in &self.AdditionalGids { + my_size += ::protobuf::rt::value_size(3, *value, ::protobuf::wire_format::WireTypeVarint); + }; + if !self.Username.is_empty() { + my_size += ::protobuf::rt::string_size(4, &self.Username); + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if self.UID != 0 { + os.write_uint32(1, self.UID)?; + } + if self.GID != 0 { + os.write_uint32(2, self.GID)?; + } + for v in &self.AdditionalGids { + os.write_uint32(3, *v)?; + }; + if !self.Username.is_empty() { + os.write_string(4, &self.Username)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: ::std::boxed::Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> User { + User::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint32>( + "UID", + |m: &User| { &m.UID }, + |m: &mut User| { &mut m.UID }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint32>( + "GID", + |m: &User| { &m.GID }, + |m: &mut User| { &mut m.GID }, + )); + fields.push(::protobuf::reflect::accessor::make_vec_accessor::<_, ::protobuf::types::ProtobufTypeUint32>( + "AdditionalGids", + |m: &User| { &m.AdditionalGids }, + |m: &mut User| { &mut m.AdditionalGids }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "Username", + |m: &User| { &m.Username }, + |m: &mut User| { &mut m.Username }, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "User", + fields, + file_descriptor_proto() + ) + }) + } + } + + fn default_instance() -> &'static User { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const User, + }; + unsafe { + instance.get(User::new) + } + } +} + +impl ::protobuf::Clear for User { + fn clear(&mut self) { + self.UID = 0; + self.GID = 0; + self.AdditionalGids.clear(); + self.Username.clear(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for User { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for User { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct LinuxCapabilities { + // message fields + pub Bounding: ::protobuf::RepeatedField<::std::string::String>, + pub Effective: ::protobuf::RepeatedField<::std::string::String>, + pub Inheritable: ::protobuf::RepeatedField<::std::string::String>, + pub Permitted: ::protobuf::RepeatedField<::std::string::String>, + pub Ambient: ::protobuf::RepeatedField<::std::string::String>, + // special fields + pub unknown_fields: ::protobuf::UnknownFields, + pub cached_size: ::protobuf::CachedSize, +} + +impl<'a> ::std::default::Default for &'a LinuxCapabilities { + fn default() -> &'a LinuxCapabilities { + ::default_instance() + } +} + +impl LinuxCapabilities { + pub fn new() -> LinuxCapabilities { + ::std::default::Default::default() + } + + // repeated string Bounding = 1; + + + pub fn get_Bounding(&self) -> &[::std::string::String] { + &self.Bounding + } + pub fn clear_Bounding(&mut self) { + self.Bounding.clear(); + } + + // Param is passed by value, moved + pub fn set_Bounding(&mut self, v: ::protobuf::RepeatedField<::std::string::String>) { + self.Bounding = v; + } + + // Mutable pointer to the field. + pub fn mut_Bounding(&mut self) -> &mut ::protobuf::RepeatedField<::std::string::String> { + &mut self.Bounding + } + + // Take field + pub fn take_Bounding(&mut self) -> ::protobuf::RepeatedField<::std::string::String> { + ::std::mem::replace(&mut self.Bounding, ::protobuf::RepeatedField::new()) + } + + // repeated string Effective = 2; + + + pub fn get_Effective(&self) -> &[::std::string::String] { + &self.Effective + } + pub fn clear_Effective(&mut self) { + self.Effective.clear(); + } + + // Param is passed by value, moved + pub fn set_Effective(&mut self, v: ::protobuf::RepeatedField<::std::string::String>) { + self.Effective = v; + } + + // Mutable pointer to the field. + pub fn mut_Effective(&mut self) -> &mut ::protobuf::RepeatedField<::std::string::String> { + &mut self.Effective + } + + // Take field + pub fn take_Effective(&mut self) -> ::protobuf::RepeatedField<::std::string::String> { + ::std::mem::replace(&mut self.Effective, ::protobuf::RepeatedField::new()) + } + + // repeated string Inheritable = 3; + + + pub fn get_Inheritable(&self) -> &[::std::string::String] { + &self.Inheritable + } + pub fn clear_Inheritable(&mut self) { + self.Inheritable.clear(); + } + + // Param is passed by value, moved + pub fn set_Inheritable(&mut self, v: ::protobuf::RepeatedField<::std::string::String>) { + self.Inheritable = v; + } + + // Mutable pointer to the field. + pub fn mut_Inheritable(&mut self) -> &mut ::protobuf::RepeatedField<::std::string::String> { + &mut self.Inheritable + } + + // Take field + pub fn take_Inheritable(&mut self) -> ::protobuf::RepeatedField<::std::string::String> { + ::std::mem::replace(&mut self.Inheritable, ::protobuf::RepeatedField::new()) + } + + // repeated string Permitted = 4; + + + pub fn get_Permitted(&self) -> &[::std::string::String] { + &self.Permitted + } + pub fn clear_Permitted(&mut self) { + self.Permitted.clear(); + } + + // Param is passed by value, moved + pub fn set_Permitted(&mut self, v: ::protobuf::RepeatedField<::std::string::String>) { + self.Permitted = v; + } + + // Mutable pointer to the field. + pub fn mut_Permitted(&mut self) -> &mut ::protobuf::RepeatedField<::std::string::String> { + &mut self.Permitted + } + + // Take field + pub fn take_Permitted(&mut self) -> ::protobuf::RepeatedField<::std::string::String> { + ::std::mem::replace(&mut self.Permitted, ::protobuf::RepeatedField::new()) + } + + // repeated string Ambient = 5; + + + pub fn get_Ambient(&self) -> &[::std::string::String] { + &self.Ambient + } + pub fn clear_Ambient(&mut self) { + self.Ambient.clear(); + } + + // Param is passed by value, moved + pub fn set_Ambient(&mut self, v: ::protobuf::RepeatedField<::std::string::String>) { + self.Ambient = v; + } + + // Mutable pointer to the field. + pub fn mut_Ambient(&mut self) -> &mut ::protobuf::RepeatedField<::std::string::String> { + &mut self.Ambient + } + + // Take field + pub fn take_Ambient(&mut self) -> ::protobuf::RepeatedField<::std::string::String> { + ::std::mem::replace(&mut self.Ambient, ::protobuf::RepeatedField::new()) + } +} + +impl ::protobuf::Message for LinuxCapabilities { + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_repeated_string_into(wire_type, is, &mut self.Bounding)?; + }, + 2 => { + ::protobuf::rt::read_repeated_string_into(wire_type, is, &mut self.Effective)?; + }, + 3 => { + ::protobuf::rt::read_repeated_string_into(wire_type, is, &mut self.Inheritable)?; + }, + 4 => { + ::protobuf::rt::read_repeated_string_into(wire_type, is, &mut self.Permitted)?; + }, + 5 => { + ::protobuf::rt::read_repeated_string_into(wire_type, is, &mut self.Ambient)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + for value in &self.Bounding { + my_size += ::protobuf::rt::string_size(1, &value); + }; + for value in &self.Effective { + my_size += ::protobuf::rt::string_size(2, &value); + }; + for value in &self.Inheritable { + my_size += ::protobuf::rt::string_size(3, &value); + }; + for value in &self.Permitted { + my_size += ::protobuf::rt::string_size(4, &value); + }; + for value in &self.Ambient { + my_size += ::protobuf::rt::string_size(5, &value); + }; + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + for v in &self.Bounding { + os.write_string(1, &v)?; + }; + for v in &self.Effective { + os.write_string(2, &v)?; + }; + for v in &self.Inheritable { + os.write_string(3, &v)?; + }; + for v in &self.Permitted { + os.write_string(4, &v)?; + }; + for v in &self.Ambient { + os.write_string(5, &v)?; + }; + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: ::std::boxed::Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> LinuxCapabilities { + LinuxCapabilities::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "Bounding", + |m: &LinuxCapabilities| { &m.Bounding }, + |m: &mut LinuxCapabilities| { &mut m.Bounding }, + )); + fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "Effective", + |m: &LinuxCapabilities| { &m.Effective }, + |m: &mut LinuxCapabilities| { &mut m.Effective }, + )); + fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "Inheritable", + |m: &LinuxCapabilities| { &m.Inheritable }, + |m: &mut LinuxCapabilities| { &mut m.Inheritable }, + )); + fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "Permitted", + |m: &LinuxCapabilities| { &m.Permitted }, + |m: &mut LinuxCapabilities| { &mut m.Permitted }, + )); + fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "Ambient", + |m: &LinuxCapabilities| { &m.Ambient }, + |m: &mut LinuxCapabilities| { &mut m.Ambient }, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "LinuxCapabilities", + fields, + file_descriptor_proto() + ) + }) + } + } + + fn default_instance() -> &'static LinuxCapabilities { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const LinuxCapabilities, + }; + unsafe { + instance.get(LinuxCapabilities::new) + } + } +} + +impl ::protobuf::Clear for LinuxCapabilities { + fn clear(&mut self) { + self.Bounding.clear(); + self.Effective.clear(); + self.Inheritable.clear(); + self.Permitted.clear(); + self.Ambient.clear(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for LinuxCapabilities { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for LinuxCapabilities { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct POSIXRlimit { + // message fields + pub Type: ::std::string::String, + pub Hard: u64, + pub Soft: u64, + // special fields + pub unknown_fields: ::protobuf::UnknownFields, + pub cached_size: ::protobuf::CachedSize, +} + +impl<'a> ::std::default::Default for &'a POSIXRlimit { + fn default() -> &'a POSIXRlimit { + ::default_instance() + } +} + +impl POSIXRlimit { + pub fn new() -> POSIXRlimit { + ::std::default::Default::default() + } + + // string Type = 1; + + + pub fn get_Type(&self) -> &str { + &self.Type + } + pub fn clear_Type(&mut self) { + self.Type.clear(); + } + + // Param is passed by value, moved + pub fn set_Type(&mut self, v: ::std::string::String) { + self.Type = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_Type(&mut self) -> &mut ::std::string::String { + &mut self.Type + } + + // Take field + pub fn take_Type(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.Type, ::std::string::String::new()) + } + + // uint64 Hard = 2; + + + pub fn get_Hard(&self) -> u64 { + self.Hard + } + pub fn clear_Hard(&mut self) { + self.Hard = 0; + } + + // Param is passed by value, moved + pub fn set_Hard(&mut self, v: u64) { + self.Hard = v; + } + + // uint64 Soft = 3; + + + pub fn get_Soft(&self) -> u64 { + self.Soft + } + pub fn clear_Soft(&mut self) { + self.Soft = 0; + } + + // Param is passed by value, moved + pub fn set_Soft(&mut self, v: u64) { + self.Soft = v; + } +} + +impl ::protobuf::Message for POSIXRlimit { + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.Type)?; + }, + 2 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint64()?; + self.Hard = tmp; + }, + 3 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint64()?; + self.Soft = tmp; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if !self.Type.is_empty() { + my_size += ::protobuf::rt::string_size(1, &self.Type); + } + if self.Hard != 0 { + my_size += ::protobuf::rt::value_size(2, self.Hard, ::protobuf::wire_format::WireTypeVarint); + } + if self.Soft != 0 { + my_size += ::protobuf::rt::value_size(3, self.Soft, ::protobuf::wire_format::WireTypeVarint); + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if !self.Type.is_empty() { + os.write_string(1, &self.Type)?; + } + if self.Hard != 0 { + os.write_uint64(2, self.Hard)?; + } + if self.Soft != 0 { + os.write_uint64(3, self.Soft)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: ::std::boxed::Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> POSIXRlimit { + POSIXRlimit::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "Type", + |m: &POSIXRlimit| { &m.Type }, + |m: &mut POSIXRlimit| { &mut m.Type }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( + "Hard", + |m: &POSIXRlimit| { &m.Hard }, + |m: &mut POSIXRlimit| { &mut m.Hard }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( + "Soft", + |m: &POSIXRlimit| { &m.Soft }, + |m: &mut POSIXRlimit| { &mut m.Soft }, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "POSIXRlimit", + fields, + file_descriptor_proto() + ) + }) + } + } + + fn default_instance() -> &'static POSIXRlimit { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const POSIXRlimit, + }; + unsafe { + instance.get(POSIXRlimit::new) + } + } +} + +impl ::protobuf::Clear for POSIXRlimit { + fn clear(&mut self) { + self.Type.clear(); + self.Hard = 0; + self.Soft = 0; + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for POSIXRlimit { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for POSIXRlimit { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct Mount { + // message fields + pub destination: ::std::string::String, + pub source: ::std::string::String, + pub field_type: ::std::string::String, + pub options: ::protobuf::RepeatedField<::std::string::String>, + // special fields + pub unknown_fields: ::protobuf::UnknownFields, + pub cached_size: ::protobuf::CachedSize, +} + +impl<'a> ::std::default::Default for &'a Mount { + fn default() -> &'a Mount { + ::default_instance() + } +} + +impl Mount { + pub fn new() -> Mount { + ::std::default::Default::default() + } + + // string destination = 1; + + + pub fn get_destination(&self) -> &str { + &self.destination + } + pub fn clear_destination(&mut self) { + self.destination.clear(); + } + + // Param is passed by value, moved + pub fn set_destination(&mut self, v: ::std::string::String) { + self.destination = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_destination(&mut self) -> &mut ::std::string::String { + &mut self.destination + } + + // Take field + pub fn take_destination(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.destination, ::std::string::String::new()) + } + + // string source = 2; + + + pub fn get_source(&self) -> &str { + &self.source + } + pub fn clear_source(&mut self) { + self.source.clear(); + } + + // Param is passed by value, moved + pub fn set_source(&mut self, v: ::std::string::String) { + self.source = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_source(&mut self) -> &mut ::std::string::String { + &mut self.source + } + + // Take field + pub fn take_source(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.source, ::std::string::String::new()) + } + + // string type = 3; + + + pub fn get_field_type(&self) -> &str { + &self.field_type + } + pub fn clear_field_type(&mut self) { + self.field_type.clear(); + } + + // Param is passed by value, moved + pub fn set_field_type(&mut self, v: ::std::string::String) { + self.field_type = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_field_type(&mut self) -> &mut ::std::string::String { + &mut self.field_type + } + + // Take field + pub fn take_field_type(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.field_type, ::std::string::String::new()) + } + + // repeated string options = 4; + + + pub fn get_options(&self) -> &[::std::string::String] { + &self.options + } + pub fn clear_options(&mut self) { + self.options.clear(); + } + + // Param is passed by value, moved + pub fn set_options(&mut self, v: ::protobuf::RepeatedField<::std::string::String>) { + self.options = v; + } + + // Mutable pointer to the field. + pub fn mut_options(&mut self) -> &mut ::protobuf::RepeatedField<::std::string::String> { + &mut self.options + } + + // Take field + pub fn take_options(&mut self) -> ::protobuf::RepeatedField<::std::string::String> { + ::std::mem::replace(&mut self.options, ::protobuf::RepeatedField::new()) + } +} + +impl ::protobuf::Message for Mount { + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.destination)?; + }, + 2 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.source)?; + }, + 3 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.field_type)?; + }, + 4 => { + ::protobuf::rt::read_repeated_string_into(wire_type, is, &mut self.options)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if !self.destination.is_empty() { + my_size += ::protobuf::rt::string_size(1, &self.destination); + } + if !self.source.is_empty() { + my_size += ::protobuf::rt::string_size(2, &self.source); + } + if !self.field_type.is_empty() { + my_size += ::protobuf::rt::string_size(3, &self.field_type); + } + for value in &self.options { + my_size += ::protobuf::rt::string_size(4, &value); + }; + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if !self.destination.is_empty() { + os.write_string(1, &self.destination)?; + } + if !self.source.is_empty() { + os.write_string(2, &self.source)?; + } + if !self.field_type.is_empty() { + os.write_string(3, &self.field_type)?; + } + for v in &self.options { + os.write_string(4, &v)?; + }; + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: ::std::boxed::Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> Mount { + Mount::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "destination", + |m: &Mount| { &m.destination }, + |m: &mut Mount| { &mut m.destination }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "source", + |m: &Mount| { &m.source }, + |m: &mut Mount| { &mut m.source }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "type", + |m: &Mount| { &m.field_type }, + |m: &mut Mount| { &mut m.field_type }, + )); + fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "options", + |m: &Mount| { &m.options }, + |m: &mut Mount| { &mut m.options }, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "Mount", + fields, + file_descriptor_proto() + ) + }) + } + } + + fn default_instance() -> &'static Mount { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const Mount, + }; + unsafe { + instance.get(Mount::new) + } + } +} + +impl ::protobuf::Clear for Mount { + fn clear(&mut self) { + self.destination.clear(); + self.source.clear(); + self.field_type.clear(); + self.options.clear(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for Mount { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for Mount { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct Root { + // message fields + pub Path: ::std::string::String, + pub Readonly: bool, + // special fields + pub unknown_fields: ::protobuf::UnknownFields, + pub cached_size: ::protobuf::CachedSize, +} + +impl<'a> ::std::default::Default for &'a Root { + fn default() -> &'a Root { + ::default_instance() + } +} + +impl Root { + pub fn new() -> Root { + ::std::default::Default::default() + } + + // string Path = 1; + + + pub fn get_Path(&self) -> &str { + &self.Path + } + pub fn clear_Path(&mut self) { + self.Path.clear(); + } + + // Param is passed by value, moved + pub fn set_Path(&mut self, v: ::std::string::String) { + self.Path = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_Path(&mut self) -> &mut ::std::string::String { + &mut self.Path + } + + // Take field + pub fn take_Path(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.Path, ::std::string::String::new()) + } + + // bool Readonly = 2; + + + pub fn get_Readonly(&self) -> bool { + self.Readonly + } + pub fn clear_Readonly(&mut self) { + self.Readonly = false; + } + + // Param is passed by value, moved + pub fn set_Readonly(&mut self, v: bool) { + self.Readonly = v; + } +} + +impl ::protobuf::Message for Root { + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.Path)?; + }, + 2 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_bool()?; + self.Readonly = tmp; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if !self.Path.is_empty() { + my_size += ::protobuf::rt::string_size(1, &self.Path); + } + if self.Readonly != false { + my_size += 2; + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if !self.Path.is_empty() { + os.write_string(1, &self.Path)?; + } + if self.Readonly != false { + os.write_bool(2, self.Readonly)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: ::std::boxed::Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> Root { + Root::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "Path", + |m: &Root| { &m.Path }, + |m: &mut Root| { &mut m.Path }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeBool>( + "Readonly", + |m: &Root| { &m.Readonly }, + |m: &mut Root| { &mut m.Readonly }, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "Root", + fields, + file_descriptor_proto() + ) + }) + } + } + + fn default_instance() -> &'static Root { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const Root, + }; + unsafe { + instance.get(Root::new) + } + } +} + +impl ::protobuf::Clear for Root { + fn clear(&mut self) { + self.Path.clear(); + self.Readonly = false; + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for Root { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for Root { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct Hooks { + // message fields + pub Prestart: ::protobuf::RepeatedField, + pub Poststart: ::protobuf::RepeatedField, + pub Poststop: ::protobuf::RepeatedField, + // special fields + pub unknown_fields: ::protobuf::UnknownFields, + pub cached_size: ::protobuf::CachedSize, +} + +impl<'a> ::std::default::Default for &'a Hooks { + fn default() -> &'a Hooks { + ::default_instance() + } +} + +impl Hooks { + pub fn new() -> Hooks { + ::std::default::Default::default() + } + + // repeated .grpc.Hook Prestart = 1; + + + pub fn get_Prestart(&self) -> &[Hook] { + &self.Prestart + } + pub fn clear_Prestart(&mut self) { + self.Prestart.clear(); + } + + // Param is passed by value, moved + pub fn set_Prestart(&mut self, v: ::protobuf::RepeatedField) { + self.Prestart = v; + } + + // Mutable pointer to the field. + pub fn mut_Prestart(&mut self) -> &mut ::protobuf::RepeatedField { + &mut self.Prestart + } + + // Take field + pub fn take_Prestart(&mut self) -> ::protobuf::RepeatedField { + ::std::mem::replace(&mut self.Prestart, ::protobuf::RepeatedField::new()) + } + + // repeated .grpc.Hook Poststart = 2; + + + pub fn get_Poststart(&self) -> &[Hook] { + &self.Poststart + } + pub fn clear_Poststart(&mut self) { + self.Poststart.clear(); + } + + // Param is passed by value, moved + pub fn set_Poststart(&mut self, v: ::protobuf::RepeatedField) { + self.Poststart = v; + } + + // Mutable pointer to the field. + pub fn mut_Poststart(&mut self) -> &mut ::protobuf::RepeatedField { + &mut self.Poststart + } + + // Take field + pub fn take_Poststart(&mut self) -> ::protobuf::RepeatedField { + ::std::mem::replace(&mut self.Poststart, ::protobuf::RepeatedField::new()) + } + + // repeated .grpc.Hook Poststop = 3; + + + pub fn get_Poststop(&self) -> &[Hook] { + &self.Poststop + } + pub fn clear_Poststop(&mut self) { + self.Poststop.clear(); + } + + // Param is passed by value, moved + pub fn set_Poststop(&mut self, v: ::protobuf::RepeatedField) { + self.Poststop = v; + } + + // Mutable pointer to the field. + pub fn mut_Poststop(&mut self) -> &mut ::protobuf::RepeatedField { + &mut self.Poststop + } + + // Take field + pub fn take_Poststop(&mut self) -> ::protobuf::RepeatedField { + ::std::mem::replace(&mut self.Poststop, ::protobuf::RepeatedField::new()) + } +} + +impl ::protobuf::Message for Hooks { + fn is_initialized(&self) -> bool { + for v in &self.Prestart { + if !v.is_initialized() { + return false; + } + }; + for v in &self.Poststart { + if !v.is_initialized() { + return false; + } + }; + for v in &self.Poststop { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_repeated_message_into(wire_type, is, &mut self.Prestart)?; + }, + 2 => { + ::protobuf::rt::read_repeated_message_into(wire_type, is, &mut self.Poststart)?; + }, + 3 => { + ::protobuf::rt::read_repeated_message_into(wire_type, is, &mut self.Poststop)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + for value in &self.Prestart { + let len = value.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + }; + for value in &self.Poststart { + let len = value.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + }; + for value in &self.Poststop { + let len = value.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + }; + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + for v in &self.Prestart { + os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + }; + for v in &self.Poststart { + os.write_tag(2, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + }; + for v in &self.Poststop { + os.write_tag(3, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + }; + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: ::std::boxed::Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> Hooks { + Hooks::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "Prestart", + |m: &Hooks| { &m.Prestart }, + |m: &mut Hooks| { &mut m.Prestart }, + )); + fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "Poststart", + |m: &Hooks| { &m.Poststart }, + |m: &mut Hooks| { &mut m.Poststart }, + )); + fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "Poststop", + |m: &Hooks| { &m.Poststop }, + |m: &mut Hooks| { &mut m.Poststop }, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "Hooks", + fields, + file_descriptor_proto() + ) + }) + } + } + + fn default_instance() -> &'static Hooks { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const Hooks, + }; + unsafe { + instance.get(Hooks::new) + } + } +} + +impl ::protobuf::Clear for Hooks { + fn clear(&mut self) { + self.Prestart.clear(); + self.Poststart.clear(); + self.Poststop.clear(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for Hooks { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for Hooks { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct Hook { + // message fields + pub Path: ::std::string::String, + pub Args: ::protobuf::RepeatedField<::std::string::String>, + pub Env: ::protobuf::RepeatedField<::std::string::String>, + pub Timeout: i64, + // special fields + pub unknown_fields: ::protobuf::UnknownFields, + pub cached_size: ::protobuf::CachedSize, +} + +impl<'a> ::std::default::Default for &'a Hook { + fn default() -> &'a Hook { + ::default_instance() + } +} + +impl Hook { + pub fn new() -> Hook { + ::std::default::Default::default() + } + + // string Path = 1; + + + pub fn get_Path(&self) -> &str { + &self.Path + } + pub fn clear_Path(&mut self) { + self.Path.clear(); + } + + // Param is passed by value, moved + pub fn set_Path(&mut self, v: ::std::string::String) { + self.Path = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_Path(&mut self) -> &mut ::std::string::String { + &mut self.Path + } + + // Take field + pub fn take_Path(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.Path, ::std::string::String::new()) + } + + // repeated string Args = 2; + + + pub fn get_Args(&self) -> &[::std::string::String] { + &self.Args + } + pub fn clear_Args(&mut self) { + self.Args.clear(); + } + + // Param is passed by value, moved + pub fn set_Args(&mut self, v: ::protobuf::RepeatedField<::std::string::String>) { + self.Args = v; + } + + // Mutable pointer to the field. + pub fn mut_Args(&mut self) -> &mut ::protobuf::RepeatedField<::std::string::String> { + &mut self.Args + } + + // Take field + pub fn take_Args(&mut self) -> ::protobuf::RepeatedField<::std::string::String> { + ::std::mem::replace(&mut self.Args, ::protobuf::RepeatedField::new()) + } + + // repeated string Env = 3; + + + pub fn get_Env(&self) -> &[::std::string::String] { + &self.Env + } + pub fn clear_Env(&mut self) { + self.Env.clear(); + } + + // Param is passed by value, moved + pub fn set_Env(&mut self, v: ::protobuf::RepeatedField<::std::string::String>) { + self.Env = v; + } + + // Mutable pointer to the field. + pub fn mut_Env(&mut self) -> &mut ::protobuf::RepeatedField<::std::string::String> { + &mut self.Env + } + + // Take field + pub fn take_Env(&mut self) -> ::protobuf::RepeatedField<::std::string::String> { + ::std::mem::replace(&mut self.Env, ::protobuf::RepeatedField::new()) + } + + // int64 Timeout = 4; + + + pub fn get_Timeout(&self) -> i64 { + self.Timeout + } + pub fn clear_Timeout(&mut self) { + self.Timeout = 0; + } + + // Param is passed by value, moved + pub fn set_Timeout(&mut self, v: i64) { + self.Timeout = v; + } +} + +impl ::protobuf::Message for Hook { + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.Path)?; + }, + 2 => { + ::protobuf::rt::read_repeated_string_into(wire_type, is, &mut self.Args)?; + }, + 3 => { + ::protobuf::rt::read_repeated_string_into(wire_type, is, &mut self.Env)?; + }, + 4 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_int64()?; + self.Timeout = tmp; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if !self.Path.is_empty() { + my_size += ::protobuf::rt::string_size(1, &self.Path); + } + for value in &self.Args { + my_size += ::protobuf::rt::string_size(2, &value); + }; + for value in &self.Env { + my_size += ::protobuf::rt::string_size(3, &value); + }; + if self.Timeout != 0 { + my_size += ::protobuf::rt::value_size(4, self.Timeout, ::protobuf::wire_format::WireTypeVarint); + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if !self.Path.is_empty() { + os.write_string(1, &self.Path)?; + } + for v in &self.Args { + os.write_string(2, &v)?; + }; + for v in &self.Env { + os.write_string(3, &v)?; + }; + if self.Timeout != 0 { + os.write_int64(4, self.Timeout)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: ::std::boxed::Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> Hook { + Hook::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "Path", + |m: &Hook| { &m.Path }, + |m: &mut Hook| { &mut m.Path }, + )); + fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "Args", + |m: &Hook| { &m.Args }, + |m: &mut Hook| { &mut m.Args }, + )); + fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "Env", + |m: &Hook| { &m.Env }, + |m: &mut Hook| { &mut m.Env }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeInt64>( + "Timeout", + |m: &Hook| { &m.Timeout }, + |m: &mut Hook| { &mut m.Timeout }, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "Hook", + fields, + file_descriptor_proto() + ) + }) + } + } + + fn default_instance() -> &'static Hook { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const Hook, + }; + unsafe { + instance.get(Hook::new) + } + } +} + +impl ::protobuf::Clear for Hook { + fn clear(&mut self) { + self.Path.clear(); + self.Args.clear(); + self.Env.clear(); + self.Timeout = 0; + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for Hook { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for Hook { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct Linux { + // message fields + pub UIDMappings: ::protobuf::RepeatedField, + pub GIDMappings: ::protobuf::RepeatedField, + pub Sysctl: ::std::collections::HashMap<::std::string::String, ::std::string::String>, + pub Resources: ::protobuf::SingularPtrField, + pub CgroupsPath: ::std::string::String, + pub Namespaces: ::protobuf::RepeatedField, + pub Devices: ::protobuf::RepeatedField, + pub Seccomp: ::protobuf::SingularPtrField, + pub RootfsPropagation: ::std::string::String, + pub MaskedPaths: ::protobuf::RepeatedField<::std::string::String>, + pub ReadonlyPaths: ::protobuf::RepeatedField<::std::string::String>, + pub MountLabel: ::std::string::String, + pub IntelRdt: ::protobuf::SingularPtrField, + // special fields + pub unknown_fields: ::protobuf::UnknownFields, + pub cached_size: ::protobuf::CachedSize, +} + +impl<'a> ::std::default::Default for &'a Linux { + fn default() -> &'a Linux { + ::default_instance() + } +} + +impl Linux { + pub fn new() -> Linux { + ::std::default::Default::default() + } + + // repeated .grpc.LinuxIDMapping UIDMappings = 1; + + + pub fn get_UIDMappings(&self) -> &[LinuxIDMapping] { + &self.UIDMappings + } + pub fn clear_UIDMappings(&mut self) { + self.UIDMappings.clear(); + } + + // Param is passed by value, moved + pub fn set_UIDMappings(&mut self, v: ::protobuf::RepeatedField) { + self.UIDMappings = v; + } + + // Mutable pointer to the field. + pub fn mut_UIDMappings(&mut self) -> &mut ::protobuf::RepeatedField { + &mut self.UIDMappings + } + + // Take field + pub fn take_UIDMappings(&mut self) -> ::protobuf::RepeatedField { + ::std::mem::replace(&mut self.UIDMappings, ::protobuf::RepeatedField::new()) + } + + // repeated .grpc.LinuxIDMapping GIDMappings = 2; + + + pub fn get_GIDMappings(&self) -> &[LinuxIDMapping] { + &self.GIDMappings + } + pub fn clear_GIDMappings(&mut self) { + self.GIDMappings.clear(); + } + + // Param is passed by value, moved + pub fn set_GIDMappings(&mut self, v: ::protobuf::RepeatedField) { + self.GIDMappings = v; + } + + // Mutable pointer to the field. + pub fn mut_GIDMappings(&mut self) -> &mut ::protobuf::RepeatedField { + &mut self.GIDMappings + } + + // Take field + pub fn take_GIDMappings(&mut self) -> ::protobuf::RepeatedField { + ::std::mem::replace(&mut self.GIDMappings, ::protobuf::RepeatedField::new()) + } + + // repeated .grpc.Linux.SysctlEntry Sysctl = 3; + + + pub fn get_Sysctl(&self) -> &::std::collections::HashMap<::std::string::String, ::std::string::String> { + &self.Sysctl + } + pub fn clear_Sysctl(&mut self) { + self.Sysctl.clear(); + } + + // Param is passed by value, moved + pub fn set_Sysctl(&mut self, v: ::std::collections::HashMap<::std::string::String, ::std::string::String>) { + self.Sysctl = v; + } + + // Mutable pointer to the field. + pub fn mut_Sysctl(&mut self) -> &mut ::std::collections::HashMap<::std::string::String, ::std::string::String> { + &mut self.Sysctl + } + + // Take field + pub fn take_Sysctl(&mut self) -> ::std::collections::HashMap<::std::string::String, ::std::string::String> { + ::std::mem::replace(&mut self.Sysctl, ::std::collections::HashMap::new()) + } + + // .grpc.LinuxResources Resources = 4; + + + pub fn get_Resources(&self) -> &LinuxResources { + self.Resources.as_ref().unwrap_or_else(|| LinuxResources::default_instance()) + } + pub fn clear_Resources(&mut self) { + self.Resources.clear(); + } + + pub fn has_Resources(&self) -> bool { + self.Resources.is_some() + } + + // Param is passed by value, moved + pub fn set_Resources(&mut self, v: LinuxResources) { + self.Resources = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_Resources(&mut self) -> &mut LinuxResources { + if self.Resources.is_none() { + self.Resources.set_default(); + } + self.Resources.as_mut().unwrap() + } + + // Take field + pub fn take_Resources(&mut self) -> LinuxResources { + self.Resources.take().unwrap_or_else(|| LinuxResources::new()) + } + + // string CgroupsPath = 5; + + + pub fn get_CgroupsPath(&self) -> &str { + &self.CgroupsPath + } + pub fn clear_CgroupsPath(&mut self) { + self.CgroupsPath.clear(); + } + + // Param is passed by value, moved + pub fn set_CgroupsPath(&mut self, v: ::std::string::String) { + self.CgroupsPath = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_CgroupsPath(&mut self) -> &mut ::std::string::String { + &mut self.CgroupsPath + } + + // Take field + pub fn take_CgroupsPath(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.CgroupsPath, ::std::string::String::new()) + } + + // repeated .grpc.LinuxNamespace Namespaces = 6; + + + pub fn get_Namespaces(&self) -> &[LinuxNamespace] { + &self.Namespaces + } + pub fn clear_Namespaces(&mut self) { + self.Namespaces.clear(); + } + + // Param is passed by value, moved + pub fn set_Namespaces(&mut self, v: ::protobuf::RepeatedField) { + self.Namespaces = v; + } + + // Mutable pointer to the field. + pub fn mut_Namespaces(&mut self) -> &mut ::protobuf::RepeatedField { + &mut self.Namespaces + } + + // Take field + pub fn take_Namespaces(&mut self) -> ::protobuf::RepeatedField { + ::std::mem::replace(&mut self.Namespaces, ::protobuf::RepeatedField::new()) + } + + // repeated .grpc.LinuxDevice Devices = 7; + + + pub fn get_Devices(&self) -> &[LinuxDevice] { + &self.Devices + } + pub fn clear_Devices(&mut self) { + self.Devices.clear(); + } + + // Param is passed by value, moved + pub fn set_Devices(&mut self, v: ::protobuf::RepeatedField) { + self.Devices = v; + } + + // Mutable pointer to the field. + pub fn mut_Devices(&mut self) -> &mut ::protobuf::RepeatedField { + &mut self.Devices + } + + // Take field + pub fn take_Devices(&mut self) -> ::protobuf::RepeatedField { + ::std::mem::replace(&mut self.Devices, ::protobuf::RepeatedField::new()) + } + + // .grpc.LinuxSeccomp Seccomp = 8; + + + pub fn get_Seccomp(&self) -> &LinuxSeccomp { + self.Seccomp.as_ref().unwrap_or_else(|| LinuxSeccomp::default_instance()) + } + pub fn clear_Seccomp(&mut self) { + self.Seccomp.clear(); + } + + pub fn has_Seccomp(&self) -> bool { + self.Seccomp.is_some() + } + + // Param is passed by value, moved + pub fn set_Seccomp(&mut self, v: LinuxSeccomp) { + self.Seccomp = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_Seccomp(&mut self) -> &mut LinuxSeccomp { + if self.Seccomp.is_none() { + self.Seccomp.set_default(); + } + self.Seccomp.as_mut().unwrap() + } + + // Take field + pub fn take_Seccomp(&mut self) -> LinuxSeccomp { + self.Seccomp.take().unwrap_or_else(|| LinuxSeccomp::new()) + } + + // string RootfsPropagation = 9; + + + pub fn get_RootfsPropagation(&self) -> &str { + &self.RootfsPropagation + } + pub fn clear_RootfsPropagation(&mut self) { + self.RootfsPropagation.clear(); + } + + // Param is passed by value, moved + pub fn set_RootfsPropagation(&mut self, v: ::std::string::String) { + self.RootfsPropagation = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_RootfsPropagation(&mut self) -> &mut ::std::string::String { + &mut self.RootfsPropagation + } + + // Take field + pub fn take_RootfsPropagation(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.RootfsPropagation, ::std::string::String::new()) + } + + // repeated string MaskedPaths = 10; + + + pub fn get_MaskedPaths(&self) -> &[::std::string::String] { + &self.MaskedPaths + } + pub fn clear_MaskedPaths(&mut self) { + self.MaskedPaths.clear(); + } + + // Param is passed by value, moved + pub fn set_MaskedPaths(&mut self, v: ::protobuf::RepeatedField<::std::string::String>) { + self.MaskedPaths = v; + } + + // Mutable pointer to the field. + pub fn mut_MaskedPaths(&mut self) -> &mut ::protobuf::RepeatedField<::std::string::String> { + &mut self.MaskedPaths + } + + // Take field + pub fn take_MaskedPaths(&mut self) -> ::protobuf::RepeatedField<::std::string::String> { + ::std::mem::replace(&mut self.MaskedPaths, ::protobuf::RepeatedField::new()) + } + + // repeated string ReadonlyPaths = 11; + + + pub fn get_ReadonlyPaths(&self) -> &[::std::string::String] { + &self.ReadonlyPaths + } + pub fn clear_ReadonlyPaths(&mut self) { + self.ReadonlyPaths.clear(); + } + + // Param is passed by value, moved + pub fn set_ReadonlyPaths(&mut self, v: ::protobuf::RepeatedField<::std::string::String>) { + self.ReadonlyPaths = v; + } + + // Mutable pointer to the field. + pub fn mut_ReadonlyPaths(&mut self) -> &mut ::protobuf::RepeatedField<::std::string::String> { + &mut self.ReadonlyPaths + } + + // Take field + pub fn take_ReadonlyPaths(&mut self) -> ::protobuf::RepeatedField<::std::string::String> { + ::std::mem::replace(&mut self.ReadonlyPaths, ::protobuf::RepeatedField::new()) + } + + // string MountLabel = 12; + + + pub fn get_MountLabel(&self) -> &str { + &self.MountLabel + } + pub fn clear_MountLabel(&mut self) { + self.MountLabel.clear(); + } + + // Param is passed by value, moved + pub fn set_MountLabel(&mut self, v: ::std::string::String) { + self.MountLabel = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_MountLabel(&mut self) -> &mut ::std::string::String { + &mut self.MountLabel + } + + // Take field + pub fn take_MountLabel(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.MountLabel, ::std::string::String::new()) + } + + // .grpc.LinuxIntelRdt IntelRdt = 13; + + + pub fn get_IntelRdt(&self) -> &LinuxIntelRdt { + self.IntelRdt.as_ref().unwrap_or_else(|| LinuxIntelRdt::default_instance()) + } + pub fn clear_IntelRdt(&mut self) { + self.IntelRdt.clear(); + } + + pub fn has_IntelRdt(&self) -> bool { + self.IntelRdt.is_some() + } + + // Param is passed by value, moved + pub fn set_IntelRdt(&mut self, v: LinuxIntelRdt) { + self.IntelRdt = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_IntelRdt(&mut self) -> &mut LinuxIntelRdt { + if self.IntelRdt.is_none() { + self.IntelRdt.set_default(); + } + self.IntelRdt.as_mut().unwrap() + } + + // Take field + pub fn take_IntelRdt(&mut self) -> LinuxIntelRdt { + self.IntelRdt.take().unwrap_or_else(|| LinuxIntelRdt::new()) + } +} + +impl ::protobuf::Message for Linux { + fn is_initialized(&self) -> bool { + for v in &self.UIDMappings { + if !v.is_initialized() { + return false; + } + }; + for v in &self.GIDMappings { + if !v.is_initialized() { + return false; + } + }; + for v in &self.Resources { + if !v.is_initialized() { + return false; + } + }; + for v in &self.Namespaces { + if !v.is_initialized() { + return false; + } + }; + for v in &self.Devices { + if !v.is_initialized() { + return false; + } + }; + for v in &self.Seccomp { + if !v.is_initialized() { + return false; + } + }; + for v in &self.IntelRdt { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_repeated_message_into(wire_type, is, &mut self.UIDMappings)?; + }, + 2 => { + ::protobuf::rt::read_repeated_message_into(wire_type, is, &mut self.GIDMappings)?; + }, + 3 => { + ::protobuf::rt::read_map_into::<::protobuf::types::ProtobufTypeString, ::protobuf::types::ProtobufTypeString>(wire_type, is, &mut self.Sysctl)?; + }, + 4 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.Resources)?; + }, + 5 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.CgroupsPath)?; + }, + 6 => { + ::protobuf::rt::read_repeated_message_into(wire_type, is, &mut self.Namespaces)?; + }, + 7 => { + ::protobuf::rt::read_repeated_message_into(wire_type, is, &mut self.Devices)?; + }, + 8 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.Seccomp)?; + }, + 9 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.RootfsPropagation)?; + }, + 10 => { + ::protobuf::rt::read_repeated_string_into(wire_type, is, &mut self.MaskedPaths)?; + }, + 11 => { + ::protobuf::rt::read_repeated_string_into(wire_type, is, &mut self.ReadonlyPaths)?; + }, + 12 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.MountLabel)?; + }, + 13 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.IntelRdt)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + for value in &self.UIDMappings { + let len = value.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + }; + for value in &self.GIDMappings { + let len = value.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + }; + my_size += ::protobuf::rt::compute_map_size::<::protobuf::types::ProtobufTypeString, ::protobuf::types::ProtobufTypeString>(3, &self.Sysctl); + if let Some(ref v) = self.Resources.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + if !self.CgroupsPath.is_empty() { + my_size += ::protobuf::rt::string_size(5, &self.CgroupsPath); + } + for value in &self.Namespaces { + let len = value.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + }; + for value in &self.Devices { + let len = value.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + }; + if let Some(ref v) = self.Seccomp.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + if !self.RootfsPropagation.is_empty() { + my_size += ::protobuf::rt::string_size(9, &self.RootfsPropagation); + } + for value in &self.MaskedPaths { + my_size += ::protobuf::rt::string_size(10, &value); + }; + for value in &self.ReadonlyPaths { + my_size += ::protobuf::rt::string_size(11, &value); + }; + if !self.MountLabel.is_empty() { + my_size += ::protobuf::rt::string_size(12, &self.MountLabel); + } + if let Some(ref v) = self.IntelRdt.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + for v in &self.UIDMappings { + os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + }; + for v in &self.GIDMappings { + os.write_tag(2, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + }; + ::protobuf::rt::write_map_with_cached_sizes::<::protobuf::types::ProtobufTypeString, ::protobuf::types::ProtobufTypeString>(3, &self.Sysctl, os)?; + if let Some(ref v) = self.Resources.as_ref() { + os.write_tag(4, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + if !self.CgroupsPath.is_empty() { + os.write_string(5, &self.CgroupsPath)?; + } + for v in &self.Namespaces { + os.write_tag(6, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + }; + for v in &self.Devices { + os.write_tag(7, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + }; + if let Some(ref v) = self.Seccomp.as_ref() { + os.write_tag(8, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + if !self.RootfsPropagation.is_empty() { + os.write_string(9, &self.RootfsPropagation)?; + } + for v in &self.MaskedPaths { + os.write_string(10, &v)?; + }; + for v in &self.ReadonlyPaths { + os.write_string(11, &v)?; + }; + if !self.MountLabel.is_empty() { + os.write_string(12, &self.MountLabel)?; + } + if let Some(ref v) = self.IntelRdt.as_ref() { + os.write_tag(13, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: ::std::boxed::Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> Linux { + Linux::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "UIDMappings", + |m: &Linux| { &m.UIDMappings }, + |m: &mut Linux| { &mut m.UIDMappings }, + )); + fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "GIDMappings", + |m: &Linux| { &m.GIDMappings }, + |m: &mut Linux| { &mut m.GIDMappings }, + )); + fields.push(::protobuf::reflect::accessor::make_map_accessor::<_, ::protobuf::types::ProtobufTypeString, ::protobuf::types::ProtobufTypeString>( + "Sysctl", + |m: &Linux| { &m.Sysctl }, + |m: &mut Linux| { &mut m.Sysctl }, + )); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "Resources", + |m: &Linux| { &m.Resources }, + |m: &mut Linux| { &mut m.Resources }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "CgroupsPath", + |m: &Linux| { &m.CgroupsPath }, + |m: &mut Linux| { &mut m.CgroupsPath }, + )); + fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "Namespaces", + |m: &Linux| { &m.Namespaces }, + |m: &mut Linux| { &mut m.Namespaces }, + )); + fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "Devices", + |m: &Linux| { &m.Devices }, + |m: &mut Linux| { &mut m.Devices }, + )); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "Seccomp", + |m: &Linux| { &m.Seccomp }, + |m: &mut Linux| { &mut m.Seccomp }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "RootfsPropagation", + |m: &Linux| { &m.RootfsPropagation }, + |m: &mut Linux| { &mut m.RootfsPropagation }, + )); + fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "MaskedPaths", + |m: &Linux| { &m.MaskedPaths }, + |m: &mut Linux| { &mut m.MaskedPaths }, + )); + fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "ReadonlyPaths", + |m: &Linux| { &m.ReadonlyPaths }, + |m: &mut Linux| { &mut m.ReadonlyPaths }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "MountLabel", + |m: &Linux| { &m.MountLabel }, + |m: &mut Linux| { &mut m.MountLabel }, + )); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "IntelRdt", + |m: &Linux| { &m.IntelRdt }, + |m: &mut Linux| { &mut m.IntelRdt }, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "Linux", + fields, + file_descriptor_proto() + ) + }) + } + } + + fn default_instance() -> &'static Linux { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const Linux, + }; + unsafe { + instance.get(Linux::new) + } + } +} + +impl ::protobuf::Clear for Linux { + fn clear(&mut self) { + self.UIDMappings.clear(); + self.GIDMappings.clear(); + self.Sysctl.clear(); + self.Resources.clear(); + self.CgroupsPath.clear(); + self.Namespaces.clear(); + self.Devices.clear(); + self.Seccomp.clear(); + self.RootfsPropagation.clear(); + self.MaskedPaths.clear(); + self.ReadonlyPaths.clear(); + self.MountLabel.clear(); + self.IntelRdt.clear(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for Linux { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for Linux { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct Windows { + // message fields + pub dummy: ::std::string::String, + // special fields + pub unknown_fields: ::protobuf::UnknownFields, + pub cached_size: ::protobuf::CachedSize, +} + +impl<'a> ::std::default::Default for &'a Windows { + fn default() -> &'a Windows { + ::default_instance() + } +} + +impl Windows { + pub fn new() -> Windows { + ::std::default::Default::default() + } + + // string dummy = 1; + + + pub fn get_dummy(&self) -> &str { + &self.dummy + } + pub fn clear_dummy(&mut self) { + self.dummy.clear(); + } + + // Param is passed by value, moved + pub fn set_dummy(&mut self, v: ::std::string::String) { + self.dummy = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_dummy(&mut self) -> &mut ::std::string::String { + &mut self.dummy + } + + // Take field + pub fn take_dummy(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.dummy, ::std::string::String::new()) + } +} + +impl ::protobuf::Message for Windows { + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.dummy)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if !self.dummy.is_empty() { + my_size += ::protobuf::rt::string_size(1, &self.dummy); + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if !self.dummy.is_empty() { + os.write_string(1, &self.dummy)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: ::std::boxed::Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> Windows { + Windows::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "dummy", + |m: &Windows| { &m.dummy }, + |m: &mut Windows| { &mut m.dummy }, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "Windows", + fields, + file_descriptor_proto() + ) + }) + } + } + + fn default_instance() -> &'static Windows { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const Windows, + }; + unsafe { + instance.get(Windows::new) + } + } +} + +impl ::protobuf::Clear for Windows { + fn clear(&mut self) { + self.dummy.clear(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for Windows { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for Windows { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct Solaris { + // message fields + pub dummy: ::std::string::String, + // special fields + pub unknown_fields: ::protobuf::UnknownFields, + pub cached_size: ::protobuf::CachedSize, +} + +impl<'a> ::std::default::Default for &'a Solaris { + fn default() -> &'a Solaris { + ::default_instance() + } +} + +impl Solaris { + pub fn new() -> Solaris { + ::std::default::Default::default() + } + + // string dummy = 1; + + + pub fn get_dummy(&self) -> &str { + &self.dummy + } + pub fn clear_dummy(&mut self) { + self.dummy.clear(); + } + + // Param is passed by value, moved + pub fn set_dummy(&mut self, v: ::std::string::String) { + self.dummy = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_dummy(&mut self) -> &mut ::std::string::String { + &mut self.dummy + } + + // Take field + pub fn take_dummy(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.dummy, ::std::string::String::new()) + } +} + +impl ::protobuf::Message for Solaris { + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.dummy)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if !self.dummy.is_empty() { + my_size += ::protobuf::rt::string_size(1, &self.dummy); + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if !self.dummy.is_empty() { + os.write_string(1, &self.dummy)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: ::std::boxed::Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> Solaris { + Solaris::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "dummy", + |m: &Solaris| { &m.dummy }, + |m: &mut Solaris| { &mut m.dummy }, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "Solaris", + fields, + file_descriptor_proto() + ) + }) + } + } + + fn default_instance() -> &'static Solaris { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const Solaris, + }; + unsafe { + instance.get(Solaris::new) + } + } +} + +impl ::protobuf::Clear for Solaris { + fn clear(&mut self) { + self.dummy.clear(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for Solaris { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for Solaris { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct LinuxIDMapping { + // message fields + pub HostID: u32, + pub ContainerID: u32, + pub Size: u32, + // special fields + pub unknown_fields: ::protobuf::UnknownFields, + pub cached_size: ::protobuf::CachedSize, +} + +impl<'a> ::std::default::Default for &'a LinuxIDMapping { + fn default() -> &'a LinuxIDMapping { + ::default_instance() + } +} + +impl LinuxIDMapping { + pub fn new() -> LinuxIDMapping { + ::std::default::Default::default() + } + + // uint32 HostID = 1; + + + pub fn get_HostID(&self) -> u32 { + self.HostID + } + pub fn clear_HostID(&mut self) { + self.HostID = 0; + } + + // Param is passed by value, moved + pub fn set_HostID(&mut self, v: u32) { + self.HostID = v; + } + + // uint32 ContainerID = 2; + + + pub fn get_ContainerID(&self) -> u32 { + self.ContainerID + } + pub fn clear_ContainerID(&mut self) { + self.ContainerID = 0; + } + + // Param is passed by value, moved + pub fn set_ContainerID(&mut self, v: u32) { + self.ContainerID = v; + } + + // uint32 Size = 3; + + + pub fn get_Size(&self) -> u32 { + self.Size + } + pub fn clear_Size(&mut self) { + self.Size = 0; + } + + // Param is passed by value, moved + pub fn set_Size(&mut self, v: u32) { + self.Size = v; + } +} + +impl ::protobuf::Message for LinuxIDMapping { + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint32()?; + self.HostID = tmp; + }, + 2 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint32()?; + self.ContainerID = tmp; + }, + 3 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint32()?; + self.Size = tmp; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if self.HostID != 0 { + my_size += ::protobuf::rt::value_size(1, self.HostID, ::protobuf::wire_format::WireTypeVarint); + } + if self.ContainerID != 0 { + my_size += ::protobuf::rt::value_size(2, self.ContainerID, ::protobuf::wire_format::WireTypeVarint); + } + if self.Size != 0 { + my_size += ::protobuf::rt::value_size(3, self.Size, ::protobuf::wire_format::WireTypeVarint); + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if self.HostID != 0 { + os.write_uint32(1, self.HostID)?; + } + if self.ContainerID != 0 { + os.write_uint32(2, self.ContainerID)?; + } + if self.Size != 0 { + os.write_uint32(3, self.Size)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: ::std::boxed::Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> LinuxIDMapping { + LinuxIDMapping::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint32>( + "HostID", + |m: &LinuxIDMapping| { &m.HostID }, + |m: &mut LinuxIDMapping| { &mut m.HostID }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint32>( + "ContainerID", + |m: &LinuxIDMapping| { &m.ContainerID }, + |m: &mut LinuxIDMapping| { &mut m.ContainerID }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint32>( + "Size", + |m: &LinuxIDMapping| { &m.Size }, + |m: &mut LinuxIDMapping| { &mut m.Size }, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "LinuxIDMapping", + fields, + file_descriptor_proto() + ) + }) + } + } + + fn default_instance() -> &'static LinuxIDMapping { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const LinuxIDMapping, + }; + unsafe { + instance.get(LinuxIDMapping::new) + } + } +} + +impl ::protobuf::Clear for LinuxIDMapping { + fn clear(&mut self) { + self.HostID = 0; + self.ContainerID = 0; + self.Size = 0; + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for LinuxIDMapping { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for LinuxIDMapping { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct LinuxNamespace { + // message fields + pub Type: ::std::string::String, + pub Path: ::std::string::String, + // special fields + pub unknown_fields: ::protobuf::UnknownFields, + pub cached_size: ::protobuf::CachedSize, +} + +impl<'a> ::std::default::Default for &'a LinuxNamespace { + fn default() -> &'a LinuxNamespace { + ::default_instance() + } +} + +impl LinuxNamespace { + pub fn new() -> LinuxNamespace { + ::std::default::Default::default() + } + + // string Type = 1; + + + pub fn get_Type(&self) -> &str { + &self.Type + } + pub fn clear_Type(&mut self) { + self.Type.clear(); + } + + // Param is passed by value, moved + pub fn set_Type(&mut self, v: ::std::string::String) { + self.Type = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_Type(&mut self) -> &mut ::std::string::String { + &mut self.Type + } + + // Take field + pub fn take_Type(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.Type, ::std::string::String::new()) + } + + // string Path = 2; + + + pub fn get_Path(&self) -> &str { + &self.Path + } + pub fn clear_Path(&mut self) { + self.Path.clear(); + } + + // Param is passed by value, moved + pub fn set_Path(&mut self, v: ::std::string::String) { + self.Path = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_Path(&mut self) -> &mut ::std::string::String { + &mut self.Path + } + + // Take field + pub fn take_Path(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.Path, ::std::string::String::new()) + } +} + +impl ::protobuf::Message for LinuxNamespace { + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.Type)?; + }, + 2 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.Path)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if !self.Type.is_empty() { + my_size += ::protobuf::rt::string_size(1, &self.Type); + } + if !self.Path.is_empty() { + my_size += ::protobuf::rt::string_size(2, &self.Path); + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if !self.Type.is_empty() { + os.write_string(1, &self.Type)?; + } + if !self.Path.is_empty() { + os.write_string(2, &self.Path)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: ::std::boxed::Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> LinuxNamespace { + LinuxNamespace::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "Type", + |m: &LinuxNamespace| { &m.Type }, + |m: &mut LinuxNamespace| { &mut m.Type }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "Path", + |m: &LinuxNamespace| { &m.Path }, + |m: &mut LinuxNamespace| { &mut m.Path }, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "LinuxNamespace", + fields, + file_descriptor_proto() + ) + }) + } + } + + fn default_instance() -> &'static LinuxNamespace { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const LinuxNamespace, + }; + unsafe { + instance.get(LinuxNamespace::new) + } + } +} + +impl ::protobuf::Clear for LinuxNamespace { + fn clear(&mut self) { + self.Type.clear(); + self.Path.clear(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for LinuxNamespace { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for LinuxNamespace { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct LinuxDevice { + // message fields + pub Path: ::std::string::String, + pub Type: ::std::string::String, + pub Major: i64, + pub Minor: i64, + pub FileMode: u32, + pub UID: u32, + pub GID: u32, + // special fields + pub unknown_fields: ::protobuf::UnknownFields, + pub cached_size: ::protobuf::CachedSize, +} + +impl<'a> ::std::default::Default for &'a LinuxDevice { + fn default() -> &'a LinuxDevice { + ::default_instance() + } +} + +impl LinuxDevice { + pub fn new() -> LinuxDevice { + ::std::default::Default::default() + } + + // string Path = 1; + + + pub fn get_Path(&self) -> &str { + &self.Path + } + pub fn clear_Path(&mut self) { + self.Path.clear(); + } + + // Param is passed by value, moved + pub fn set_Path(&mut self, v: ::std::string::String) { + self.Path = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_Path(&mut self) -> &mut ::std::string::String { + &mut self.Path + } + + // Take field + pub fn take_Path(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.Path, ::std::string::String::new()) + } + + // string Type = 2; + + + pub fn get_Type(&self) -> &str { + &self.Type + } + pub fn clear_Type(&mut self) { + self.Type.clear(); + } + + // Param is passed by value, moved + pub fn set_Type(&mut self, v: ::std::string::String) { + self.Type = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_Type(&mut self) -> &mut ::std::string::String { + &mut self.Type + } + + // Take field + pub fn take_Type(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.Type, ::std::string::String::new()) + } + + // int64 Major = 3; + + + pub fn get_Major(&self) -> i64 { + self.Major + } + pub fn clear_Major(&mut self) { + self.Major = 0; + } + + // Param is passed by value, moved + pub fn set_Major(&mut self, v: i64) { + self.Major = v; + } + + // int64 Minor = 4; + + + pub fn get_Minor(&self) -> i64 { + self.Minor + } + pub fn clear_Minor(&mut self) { + self.Minor = 0; + } + + // Param is passed by value, moved + pub fn set_Minor(&mut self, v: i64) { + self.Minor = v; + } + + // uint32 FileMode = 5; + + + pub fn get_FileMode(&self) -> u32 { + self.FileMode + } + pub fn clear_FileMode(&mut self) { + self.FileMode = 0; + } + + // Param is passed by value, moved + pub fn set_FileMode(&mut self, v: u32) { + self.FileMode = v; + } + + // uint32 UID = 6; + + + pub fn get_UID(&self) -> u32 { + self.UID + } + pub fn clear_UID(&mut self) { + self.UID = 0; + } + + // Param is passed by value, moved + pub fn set_UID(&mut self, v: u32) { + self.UID = v; + } + + // uint32 GID = 7; + + + pub fn get_GID(&self) -> u32 { + self.GID + } + pub fn clear_GID(&mut self) { + self.GID = 0; + } + + // Param is passed by value, moved + pub fn set_GID(&mut self, v: u32) { + self.GID = v; + } +} + +impl ::protobuf::Message for LinuxDevice { + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.Path)?; + }, + 2 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.Type)?; + }, + 3 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_int64()?; + self.Major = tmp; + }, + 4 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_int64()?; + self.Minor = tmp; + }, + 5 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint32()?; + self.FileMode = tmp; + }, + 6 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint32()?; + self.UID = tmp; + }, + 7 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint32()?; + self.GID = tmp; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if !self.Path.is_empty() { + my_size += ::protobuf::rt::string_size(1, &self.Path); + } + if !self.Type.is_empty() { + my_size += ::protobuf::rt::string_size(2, &self.Type); + } + if self.Major != 0 { + my_size += ::protobuf::rt::value_size(3, self.Major, ::protobuf::wire_format::WireTypeVarint); + } + if self.Minor != 0 { + my_size += ::protobuf::rt::value_size(4, self.Minor, ::protobuf::wire_format::WireTypeVarint); + } + if self.FileMode != 0 { + my_size += ::protobuf::rt::value_size(5, self.FileMode, ::protobuf::wire_format::WireTypeVarint); + } + if self.UID != 0 { + my_size += ::protobuf::rt::value_size(6, self.UID, ::protobuf::wire_format::WireTypeVarint); + } + if self.GID != 0 { + my_size += ::protobuf::rt::value_size(7, self.GID, ::protobuf::wire_format::WireTypeVarint); + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if !self.Path.is_empty() { + os.write_string(1, &self.Path)?; + } + if !self.Type.is_empty() { + os.write_string(2, &self.Type)?; + } + if self.Major != 0 { + os.write_int64(3, self.Major)?; + } + if self.Minor != 0 { + os.write_int64(4, self.Minor)?; + } + if self.FileMode != 0 { + os.write_uint32(5, self.FileMode)?; + } + if self.UID != 0 { + os.write_uint32(6, self.UID)?; + } + if self.GID != 0 { + os.write_uint32(7, self.GID)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: ::std::boxed::Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> LinuxDevice { + LinuxDevice::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "Path", + |m: &LinuxDevice| { &m.Path }, + |m: &mut LinuxDevice| { &mut m.Path }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "Type", + |m: &LinuxDevice| { &m.Type }, + |m: &mut LinuxDevice| { &mut m.Type }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeInt64>( + "Major", + |m: &LinuxDevice| { &m.Major }, + |m: &mut LinuxDevice| { &mut m.Major }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeInt64>( + "Minor", + |m: &LinuxDevice| { &m.Minor }, + |m: &mut LinuxDevice| { &mut m.Minor }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint32>( + "FileMode", + |m: &LinuxDevice| { &m.FileMode }, + |m: &mut LinuxDevice| { &mut m.FileMode }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint32>( + "UID", + |m: &LinuxDevice| { &m.UID }, + |m: &mut LinuxDevice| { &mut m.UID }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint32>( + "GID", + |m: &LinuxDevice| { &m.GID }, + |m: &mut LinuxDevice| { &mut m.GID }, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "LinuxDevice", + fields, + file_descriptor_proto() + ) + }) + } + } + + fn default_instance() -> &'static LinuxDevice { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const LinuxDevice, + }; + unsafe { + instance.get(LinuxDevice::new) + } + } +} + +impl ::protobuf::Clear for LinuxDevice { + fn clear(&mut self) { + self.Path.clear(); + self.Type.clear(); + self.Major = 0; + self.Minor = 0; + self.FileMode = 0; + self.UID = 0; + self.GID = 0; + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for LinuxDevice { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for LinuxDevice { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct LinuxResources { + // message fields + pub Devices: ::protobuf::RepeatedField, + pub Memory: ::protobuf::SingularPtrField, + pub CPU: ::protobuf::SingularPtrField, + pub Pids: ::protobuf::SingularPtrField, + pub BlockIO: ::protobuf::SingularPtrField, + pub HugepageLimits: ::protobuf::RepeatedField, + pub Network: ::protobuf::SingularPtrField, + // special fields + pub unknown_fields: ::protobuf::UnknownFields, + pub cached_size: ::protobuf::CachedSize, +} + +impl<'a> ::std::default::Default for &'a LinuxResources { + fn default() -> &'a LinuxResources { + ::default_instance() + } +} + +impl LinuxResources { + pub fn new() -> LinuxResources { + ::std::default::Default::default() + } + + // repeated .grpc.LinuxDeviceCgroup Devices = 1; + + + pub fn get_Devices(&self) -> &[LinuxDeviceCgroup] { + &self.Devices + } + pub fn clear_Devices(&mut self) { + self.Devices.clear(); + } + + // Param is passed by value, moved + pub fn set_Devices(&mut self, v: ::protobuf::RepeatedField) { + self.Devices = v; + } + + // Mutable pointer to the field. + pub fn mut_Devices(&mut self) -> &mut ::protobuf::RepeatedField { + &mut self.Devices + } + + // Take field + pub fn take_Devices(&mut self) -> ::protobuf::RepeatedField { + ::std::mem::replace(&mut self.Devices, ::protobuf::RepeatedField::new()) + } + + // .grpc.LinuxMemory Memory = 2; + + + pub fn get_Memory(&self) -> &LinuxMemory { + self.Memory.as_ref().unwrap_or_else(|| LinuxMemory::default_instance()) + } + pub fn clear_Memory(&mut self) { + self.Memory.clear(); + } + + pub fn has_Memory(&self) -> bool { + self.Memory.is_some() + } + + // Param is passed by value, moved + pub fn set_Memory(&mut self, v: LinuxMemory) { + self.Memory = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_Memory(&mut self) -> &mut LinuxMemory { + if self.Memory.is_none() { + self.Memory.set_default(); + } + self.Memory.as_mut().unwrap() + } + + // Take field + pub fn take_Memory(&mut self) -> LinuxMemory { + self.Memory.take().unwrap_or_else(|| LinuxMemory::new()) + } + + // .grpc.LinuxCPU CPU = 3; + + + pub fn get_CPU(&self) -> &LinuxCPU { + self.CPU.as_ref().unwrap_or_else(|| LinuxCPU::default_instance()) + } + pub fn clear_CPU(&mut self) { + self.CPU.clear(); + } + + pub fn has_CPU(&self) -> bool { + self.CPU.is_some() + } + + // Param is passed by value, moved + pub fn set_CPU(&mut self, v: LinuxCPU) { + self.CPU = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_CPU(&mut self) -> &mut LinuxCPU { + if self.CPU.is_none() { + self.CPU.set_default(); + } + self.CPU.as_mut().unwrap() + } + + // Take field + pub fn take_CPU(&mut self) -> LinuxCPU { + self.CPU.take().unwrap_or_else(|| LinuxCPU::new()) + } + + // .grpc.LinuxPids Pids = 4; + + + pub fn get_Pids(&self) -> &LinuxPids { + self.Pids.as_ref().unwrap_or_else(|| LinuxPids::default_instance()) + } + pub fn clear_Pids(&mut self) { + self.Pids.clear(); + } + + pub fn has_Pids(&self) -> bool { + self.Pids.is_some() + } + + // Param is passed by value, moved + pub fn set_Pids(&mut self, v: LinuxPids) { + self.Pids = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_Pids(&mut self) -> &mut LinuxPids { + if self.Pids.is_none() { + self.Pids.set_default(); + } + self.Pids.as_mut().unwrap() + } + + // Take field + pub fn take_Pids(&mut self) -> LinuxPids { + self.Pids.take().unwrap_or_else(|| LinuxPids::new()) + } + + // .grpc.LinuxBlockIO BlockIO = 5; + + + pub fn get_BlockIO(&self) -> &LinuxBlockIO { + self.BlockIO.as_ref().unwrap_or_else(|| LinuxBlockIO::default_instance()) + } + pub fn clear_BlockIO(&mut self) { + self.BlockIO.clear(); + } + + pub fn has_BlockIO(&self) -> bool { + self.BlockIO.is_some() + } + + // Param is passed by value, moved + pub fn set_BlockIO(&mut self, v: LinuxBlockIO) { + self.BlockIO = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_BlockIO(&mut self) -> &mut LinuxBlockIO { + if self.BlockIO.is_none() { + self.BlockIO.set_default(); + } + self.BlockIO.as_mut().unwrap() + } + + // Take field + pub fn take_BlockIO(&mut self) -> LinuxBlockIO { + self.BlockIO.take().unwrap_or_else(|| LinuxBlockIO::new()) + } + + // repeated .grpc.LinuxHugepageLimit HugepageLimits = 6; + + + pub fn get_HugepageLimits(&self) -> &[LinuxHugepageLimit] { + &self.HugepageLimits + } + pub fn clear_HugepageLimits(&mut self) { + self.HugepageLimits.clear(); + } + + // Param is passed by value, moved + pub fn set_HugepageLimits(&mut self, v: ::protobuf::RepeatedField) { + self.HugepageLimits = v; + } + + // Mutable pointer to the field. + pub fn mut_HugepageLimits(&mut self) -> &mut ::protobuf::RepeatedField { + &mut self.HugepageLimits + } + + // Take field + pub fn take_HugepageLimits(&mut self) -> ::protobuf::RepeatedField { + ::std::mem::replace(&mut self.HugepageLimits, ::protobuf::RepeatedField::new()) + } + + // .grpc.LinuxNetwork Network = 7; + + + pub fn get_Network(&self) -> &LinuxNetwork { + self.Network.as_ref().unwrap_or_else(|| LinuxNetwork::default_instance()) + } + pub fn clear_Network(&mut self) { + self.Network.clear(); + } + + pub fn has_Network(&self) -> bool { + self.Network.is_some() + } + + // Param is passed by value, moved + pub fn set_Network(&mut self, v: LinuxNetwork) { + self.Network = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_Network(&mut self) -> &mut LinuxNetwork { + if self.Network.is_none() { + self.Network.set_default(); + } + self.Network.as_mut().unwrap() + } + + // Take field + pub fn take_Network(&mut self) -> LinuxNetwork { + self.Network.take().unwrap_or_else(|| LinuxNetwork::new()) + } +} + +impl ::protobuf::Message for LinuxResources { + fn is_initialized(&self) -> bool { + for v in &self.Devices { + if !v.is_initialized() { + return false; + } + }; + for v in &self.Memory { + if !v.is_initialized() { + return false; + } + }; + for v in &self.CPU { + if !v.is_initialized() { + return false; + } + }; + for v in &self.Pids { + if !v.is_initialized() { + return false; + } + }; + for v in &self.BlockIO { + if !v.is_initialized() { + return false; + } + }; + for v in &self.HugepageLimits { + if !v.is_initialized() { + return false; + } + }; + for v in &self.Network { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_repeated_message_into(wire_type, is, &mut self.Devices)?; + }, + 2 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.Memory)?; + }, + 3 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.CPU)?; + }, + 4 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.Pids)?; + }, + 5 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.BlockIO)?; + }, + 6 => { + ::protobuf::rt::read_repeated_message_into(wire_type, is, &mut self.HugepageLimits)?; + }, + 7 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.Network)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + for value in &self.Devices { + let len = value.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + }; + if let Some(ref v) = self.Memory.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + if let Some(ref v) = self.CPU.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + if let Some(ref v) = self.Pids.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + if let Some(ref v) = self.BlockIO.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + for value in &self.HugepageLimits { + let len = value.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + }; + if let Some(ref v) = self.Network.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + for v in &self.Devices { + os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + }; + if let Some(ref v) = self.Memory.as_ref() { + os.write_tag(2, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + if let Some(ref v) = self.CPU.as_ref() { + os.write_tag(3, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + if let Some(ref v) = self.Pids.as_ref() { + os.write_tag(4, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + if let Some(ref v) = self.BlockIO.as_ref() { + os.write_tag(5, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + for v in &self.HugepageLimits { + os.write_tag(6, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + }; + if let Some(ref v) = self.Network.as_ref() { + os.write_tag(7, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: ::std::boxed::Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> LinuxResources { + LinuxResources::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "Devices", + |m: &LinuxResources| { &m.Devices }, + |m: &mut LinuxResources| { &mut m.Devices }, + )); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "Memory", + |m: &LinuxResources| { &m.Memory }, + |m: &mut LinuxResources| { &mut m.Memory }, + )); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "CPU", + |m: &LinuxResources| { &m.CPU }, + |m: &mut LinuxResources| { &mut m.CPU }, + )); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "Pids", + |m: &LinuxResources| { &m.Pids }, + |m: &mut LinuxResources| { &mut m.Pids }, + )); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "BlockIO", + |m: &LinuxResources| { &m.BlockIO }, + |m: &mut LinuxResources| { &mut m.BlockIO }, + )); + fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "HugepageLimits", + |m: &LinuxResources| { &m.HugepageLimits }, + |m: &mut LinuxResources| { &mut m.HugepageLimits }, + )); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "Network", + |m: &LinuxResources| { &m.Network }, + |m: &mut LinuxResources| { &mut m.Network }, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "LinuxResources", + fields, + file_descriptor_proto() + ) + }) + } + } + + fn default_instance() -> &'static LinuxResources { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const LinuxResources, + }; + unsafe { + instance.get(LinuxResources::new) + } + } +} + +impl ::protobuf::Clear for LinuxResources { + fn clear(&mut self) { + self.Devices.clear(); + self.Memory.clear(); + self.CPU.clear(); + self.Pids.clear(); + self.BlockIO.clear(); + self.HugepageLimits.clear(); + self.Network.clear(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for LinuxResources { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for LinuxResources { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct LinuxMemory { + // message fields + pub Limit: i64, + pub Reservation: i64, + pub Swap: i64, + pub Kernel: i64, + pub KernelTCP: i64, + pub Swappiness: u64, + pub DisableOOMKiller: bool, + // special fields + pub unknown_fields: ::protobuf::UnknownFields, + pub cached_size: ::protobuf::CachedSize, +} + +impl<'a> ::std::default::Default for &'a LinuxMemory { + fn default() -> &'a LinuxMemory { + ::default_instance() + } +} + +impl LinuxMemory { + pub fn new() -> LinuxMemory { + ::std::default::Default::default() + } + + // int64 Limit = 1; + + + pub fn get_Limit(&self) -> i64 { + self.Limit + } + pub fn clear_Limit(&mut self) { + self.Limit = 0; + } + + // Param is passed by value, moved + pub fn set_Limit(&mut self, v: i64) { + self.Limit = v; + } + + // int64 Reservation = 2; + + + pub fn get_Reservation(&self) -> i64 { + self.Reservation + } + pub fn clear_Reservation(&mut self) { + self.Reservation = 0; + } + + // Param is passed by value, moved + pub fn set_Reservation(&mut self, v: i64) { + self.Reservation = v; + } + + // int64 Swap = 3; + + + pub fn get_Swap(&self) -> i64 { + self.Swap + } + pub fn clear_Swap(&mut self) { + self.Swap = 0; + } + + // Param is passed by value, moved + pub fn set_Swap(&mut self, v: i64) { + self.Swap = v; + } + + // int64 Kernel = 4; + + + pub fn get_Kernel(&self) -> i64 { + self.Kernel + } + pub fn clear_Kernel(&mut self) { + self.Kernel = 0; + } + + // Param is passed by value, moved + pub fn set_Kernel(&mut self, v: i64) { + self.Kernel = v; + } + + // int64 KernelTCP = 5; + + + pub fn get_KernelTCP(&self) -> i64 { + self.KernelTCP + } + pub fn clear_KernelTCP(&mut self) { + self.KernelTCP = 0; + } + + // Param is passed by value, moved + pub fn set_KernelTCP(&mut self, v: i64) { + self.KernelTCP = v; + } + + // uint64 Swappiness = 6; + + + pub fn get_Swappiness(&self) -> u64 { + self.Swappiness + } + pub fn clear_Swappiness(&mut self) { + self.Swappiness = 0; + } + + // Param is passed by value, moved + pub fn set_Swappiness(&mut self, v: u64) { + self.Swappiness = v; + } + + // bool DisableOOMKiller = 7; + + + pub fn get_DisableOOMKiller(&self) -> bool { + self.DisableOOMKiller + } + pub fn clear_DisableOOMKiller(&mut self) { + self.DisableOOMKiller = false; + } + + // Param is passed by value, moved + pub fn set_DisableOOMKiller(&mut self, v: bool) { + self.DisableOOMKiller = v; + } +} + +impl ::protobuf::Message for LinuxMemory { + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_int64()?; + self.Limit = tmp; + }, + 2 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_int64()?; + self.Reservation = tmp; + }, + 3 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_int64()?; + self.Swap = tmp; + }, + 4 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_int64()?; + self.Kernel = tmp; + }, + 5 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_int64()?; + self.KernelTCP = tmp; + }, + 6 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint64()?; + self.Swappiness = tmp; + }, + 7 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_bool()?; + self.DisableOOMKiller = tmp; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if self.Limit != 0 { + my_size += ::protobuf::rt::value_size(1, self.Limit, ::protobuf::wire_format::WireTypeVarint); + } + if self.Reservation != 0 { + my_size += ::protobuf::rt::value_size(2, self.Reservation, ::protobuf::wire_format::WireTypeVarint); + } + if self.Swap != 0 { + my_size += ::protobuf::rt::value_size(3, self.Swap, ::protobuf::wire_format::WireTypeVarint); + } + if self.Kernel != 0 { + my_size += ::protobuf::rt::value_size(4, self.Kernel, ::protobuf::wire_format::WireTypeVarint); + } + if self.KernelTCP != 0 { + my_size += ::protobuf::rt::value_size(5, self.KernelTCP, ::protobuf::wire_format::WireTypeVarint); + } + if self.Swappiness != 0 { + my_size += ::protobuf::rt::value_size(6, self.Swappiness, ::protobuf::wire_format::WireTypeVarint); + } + if self.DisableOOMKiller != false { + my_size += 2; + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if self.Limit != 0 { + os.write_int64(1, self.Limit)?; + } + if self.Reservation != 0 { + os.write_int64(2, self.Reservation)?; + } + if self.Swap != 0 { + os.write_int64(3, self.Swap)?; + } + if self.Kernel != 0 { + os.write_int64(4, self.Kernel)?; + } + if self.KernelTCP != 0 { + os.write_int64(5, self.KernelTCP)?; + } + if self.Swappiness != 0 { + os.write_uint64(6, self.Swappiness)?; + } + if self.DisableOOMKiller != false { + os.write_bool(7, self.DisableOOMKiller)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: ::std::boxed::Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> LinuxMemory { + LinuxMemory::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeInt64>( + "Limit", + |m: &LinuxMemory| { &m.Limit }, + |m: &mut LinuxMemory| { &mut m.Limit }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeInt64>( + "Reservation", + |m: &LinuxMemory| { &m.Reservation }, + |m: &mut LinuxMemory| { &mut m.Reservation }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeInt64>( + "Swap", + |m: &LinuxMemory| { &m.Swap }, + |m: &mut LinuxMemory| { &mut m.Swap }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeInt64>( + "Kernel", + |m: &LinuxMemory| { &m.Kernel }, + |m: &mut LinuxMemory| { &mut m.Kernel }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeInt64>( + "KernelTCP", + |m: &LinuxMemory| { &m.KernelTCP }, + |m: &mut LinuxMemory| { &mut m.KernelTCP }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( + "Swappiness", + |m: &LinuxMemory| { &m.Swappiness }, + |m: &mut LinuxMemory| { &mut m.Swappiness }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeBool>( + "DisableOOMKiller", + |m: &LinuxMemory| { &m.DisableOOMKiller }, + |m: &mut LinuxMemory| { &mut m.DisableOOMKiller }, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "LinuxMemory", + fields, + file_descriptor_proto() + ) + }) + } + } + + fn default_instance() -> &'static LinuxMemory { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const LinuxMemory, + }; + unsafe { + instance.get(LinuxMemory::new) + } + } +} + +impl ::protobuf::Clear for LinuxMemory { + fn clear(&mut self) { + self.Limit = 0; + self.Reservation = 0; + self.Swap = 0; + self.Kernel = 0; + self.KernelTCP = 0; + self.Swappiness = 0; + self.DisableOOMKiller = false; + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for LinuxMemory { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for LinuxMemory { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct LinuxCPU { + // message fields + pub Shares: u64, + pub Quota: i64, + pub Period: u64, + pub RealtimeRuntime: i64, + pub RealtimePeriod: u64, + pub Cpus: ::std::string::String, + pub Mems: ::std::string::String, + // special fields + pub unknown_fields: ::protobuf::UnknownFields, + pub cached_size: ::protobuf::CachedSize, +} + +impl<'a> ::std::default::Default for &'a LinuxCPU { + fn default() -> &'a LinuxCPU { + ::default_instance() + } +} + +impl LinuxCPU { + pub fn new() -> LinuxCPU { + ::std::default::Default::default() + } + + // uint64 Shares = 1; + + + pub fn get_Shares(&self) -> u64 { + self.Shares + } + pub fn clear_Shares(&mut self) { + self.Shares = 0; + } + + // Param is passed by value, moved + pub fn set_Shares(&mut self, v: u64) { + self.Shares = v; + } + + // int64 Quota = 2; + + + pub fn get_Quota(&self) -> i64 { + self.Quota + } + pub fn clear_Quota(&mut self) { + self.Quota = 0; + } + + // Param is passed by value, moved + pub fn set_Quota(&mut self, v: i64) { + self.Quota = v; + } + + // uint64 Period = 3; + + + pub fn get_Period(&self) -> u64 { + self.Period + } + pub fn clear_Period(&mut self) { + self.Period = 0; + } + + // Param is passed by value, moved + pub fn set_Period(&mut self, v: u64) { + self.Period = v; + } + + // int64 RealtimeRuntime = 4; + + + pub fn get_RealtimeRuntime(&self) -> i64 { + self.RealtimeRuntime + } + pub fn clear_RealtimeRuntime(&mut self) { + self.RealtimeRuntime = 0; + } + + // Param is passed by value, moved + pub fn set_RealtimeRuntime(&mut self, v: i64) { + self.RealtimeRuntime = v; + } + + // uint64 RealtimePeriod = 5; + + + pub fn get_RealtimePeriod(&self) -> u64 { + self.RealtimePeriod + } + pub fn clear_RealtimePeriod(&mut self) { + self.RealtimePeriod = 0; + } + + // Param is passed by value, moved + pub fn set_RealtimePeriod(&mut self, v: u64) { + self.RealtimePeriod = v; + } + + // string Cpus = 6; + + + pub fn get_Cpus(&self) -> &str { + &self.Cpus + } + pub fn clear_Cpus(&mut self) { + self.Cpus.clear(); + } + + // Param is passed by value, moved + pub fn set_Cpus(&mut self, v: ::std::string::String) { + self.Cpus = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_Cpus(&mut self) -> &mut ::std::string::String { + &mut self.Cpus + } + + // Take field + pub fn take_Cpus(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.Cpus, ::std::string::String::new()) + } + + // string Mems = 7; + + + pub fn get_Mems(&self) -> &str { + &self.Mems + } + pub fn clear_Mems(&mut self) { + self.Mems.clear(); + } + + // Param is passed by value, moved + pub fn set_Mems(&mut self, v: ::std::string::String) { + self.Mems = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_Mems(&mut self) -> &mut ::std::string::String { + &mut self.Mems + } + + // Take field + pub fn take_Mems(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.Mems, ::std::string::String::new()) + } +} + +impl ::protobuf::Message for LinuxCPU { + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint64()?; + self.Shares = tmp; + }, + 2 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_int64()?; + self.Quota = tmp; + }, + 3 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint64()?; + self.Period = tmp; + }, + 4 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_int64()?; + self.RealtimeRuntime = tmp; + }, + 5 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint64()?; + self.RealtimePeriod = tmp; + }, + 6 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.Cpus)?; + }, + 7 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.Mems)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if self.Shares != 0 { + my_size += ::protobuf::rt::value_size(1, self.Shares, ::protobuf::wire_format::WireTypeVarint); + } + if self.Quota != 0 { + my_size += ::protobuf::rt::value_size(2, self.Quota, ::protobuf::wire_format::WireTypeVarint); + } + if self.Period != 0 { + my_size += ::protobuf::rt::value_size(3, self.Period, ::protobuf::wire_format::WireTypeVarint); + } + if self.RealtimeRuntime != 0 { + my_size += ::protobuf::rt::value_size(4, self.RealtimeRuntime, ::protobuf::wire_format::WireTypeVarint); + } + if self.RealtimePeriod != 0 { + my_size += ::protobuf::rt::value_size(5, self.RealtimePeriod, ::protobuf::wire_format::WireTypeVarint); + } + if !self.Cpus.is_empty() { + my_size += ::protobuf::rt::string_size(6, &self.Cpus); + } + if !self.Mems.is_empty() { + my_size += ::protobuf::rt::string_size(7, &self.Mems); + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if self.Shares != 0 { + os.write_uint64(1, self.Shares)?; + } + if self.Quota != 0 { + os.write_int64(2, self.Quota)?; + } + if self.Period != 0 { + os.write_uint64(3, self.Period)?; + } + if self.RealtimeRuntime != 0 { + os.write_int64(4, self.RealtimeRuntime)?; + } + if self.RealtimePeriod != 0 { + os.write_uint64(5, self.RealtimePeriod)?; + } + if !self.Cpus.is_empty() { + os.write_string(6, &self.Cpus)?; + } + if !self.Mems.is_empty() { + os.write_string(7, &self.Mems)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: ::std::boxed::Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> LinuxCPU { + LinuxCPU::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( + "Shares", + |m: &LinuxCPU| { &m.Shares }, + |m: &mut LinuxCPU| { &mut m.Shares }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeInt64>( + "Quota", + |m: &LinuxCPU| { &m.Quota }, + |m: &mut LinuxCPU| { &mut m.Quota }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( + "Period", + |m: &LinuxCPU| { &m.Period }, + |m: &mut LinuxCPU| { &mut m.Period }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeInt64>( + "RealtimeRuntime", + |m: &LinuxCPU| { &m.RealtimeRuntime }, + |m: &mut LinuxCPU| { &mut m.RealtimeRuntime }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( + "RealtimePeriod", + |m: &LinuxCPU| { &m.RealtimePeriod }, + |m: &mut LinuxCPU| { &mut m.RealtimePeriod }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "Cpus", + |m: &LinuxCPU| { &m.Cpus }, + |m: &mut LinuxCPU| { &mut m.Cpus }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "Mems", + |m: &LinuxCPU| { &m.Mems }, + |m: &mut LinuxCPU| { &mut m.Mems }, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "LinuxCPU", + fields, + file_descriptor_proto() + ) + }) + } + } + + fn default_instance() -> &'static LinuxCPU { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const LinuxCPU, + }; + unsafe { + instance.get(LinuxCPU::new) + } + } +} + +impl ::protobuf::Clear for LinuxCPU { + fn clear(&mut self) { + self.Shares = 0; + self.Quota = 0; + self.Period = 0; + self.RealtimeRuntime = 0; + self.RealtimePeriod = 0; + self.Cpus.clear(); + self.Mems.clear(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for LinuxCPU { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for LinuxCPU { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct LinuxWeightDevice { + // message fields + pub Major: i64, + pub Minor: i64, + pub Weight: u32, + pub LeafWeight: u32, + // special fields + pub unknown_fields: ::protobuf::UnknownFields, + pub cached_size: ::protobuf::CachedSize, +} + +impl<'a> ::std::default::Default for &'a LinuxWeightDevice { + fn default() -> &'a LinuxWeightDevice { + ::default_instance() + } +} + +impl LinuxWeightDevice { + pub fn new() -> LinuxWeightDevice { + ::std::default::Default::default() + } + + // int64 Major = 1; + + + pub fn get_Major(&self) -> i64 { + self.Major + } + pub fn clear_Major(&mut self) { + self.Major = 0; + } + + // Param is passed by value, moved + pub fn set_Major(&mut self, v: i64) { + self.Major = v; + } + + // int64 Minor = 2; + + + pub fn get_Minor(&self) -> i64 { + self.Minor + } + pub fn clear_Minor(&mut self) { + self.Minor = 0; + } + + // Param is passed by value, moved + pub fn set_Minor(&mut self, v: i64) { + self.Minor = v; + } + + // uint32 Weight = 3; + + + pub fn get_Weight(&self) -> u32 { + self.Weight + } + pub fn clear_Weight(&mut self) { + self.Weight = 0; + } + + // Param is passed by value, moved + pub fn set_Weight(&mut self, v: u32) { + self.Weight = v; + } + + // uint32 LeafWeight = 4; + + + pub fn get_LeafWeight(&self) -> u32 { + self.LeafWeight + } + pub fn clear_LeafWeight(&mut self) { + self.LeafWeight = 0; + } + + // Param is passed by value, moved + pub fn set_LeafWeight(&mut self, v: u32) { + self.LeafWeight = v; + } +} + +impl ::protobuf::Message for LinuxWeightDevice { + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_int64()?; + self.Major = tmp; + }, + 2 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_int64()?; + self.Minor = tmp; + }, + 3 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint32()?; + self.Weight = tmp; + }, + 4 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint32()?; + self.LeafWeight = tmp; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if self.Major != 0 { + my_size += ::protobuf::rt::value_size(1, self.Major, ::protobuf::wire_format::WireTypeVarint); + } + if self.Minor != 0 { + my_size += ::protobuf::rt::value_size(2, self.Minor, ::protobuf::wire_format::WireTypeVarint); + } + if self.Weight != 0 { + my_size += ::protobuf::rt::value_size(3, self.Weight, ::protobuf::wire_format::WireTypeVarint); + } + if self.LeafWeight != 0 { + my_size += ::protobuf::rt::value_size(4, self.LeafWeight, ::protobuf::wire_format::WireTypeVarint); + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if self.Major != 0 { + os.write_int64(1, self.Major)?; + } + if self.Minor != 0 { + os.write_int64(2, self.Minor)?; + } + if self.Weight != 0 { + os.write_uint32(3, self.Weight)?; + } + if self.LeafWeight != 0 { + os.write_uint32(4, self.LeafWeight)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: ::std::boxed::Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> LinuxWeightDevice { + LinuxWeightDevice::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeInt64>( + "Major", + |m: &LinuxWeightDevice| { &m.Major }, + |m: &mut LinuxWeightDevice| { &mut m.Major }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeInt64>( + "Minor", + |m: &LinuxWeightDevice| { &m.Minor }, + |m: &mut LinuxWeightDevice| { &mut m.Minor }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint32>( + "Weight", + |m: &LinuxWeightDevice| { &m.Weight }, + |m: &mut LinuxWeightDevice| { &mut m.Weight }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint32>( + "LeafWeight", + |m: &LinuxWeightDevice| { &m.LeafWeight }, + |m: &mut LinuxWeightDevice| { &mut m.LeafWeight }, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "LinuxWeightDevice", + fields, + file_descriptor_proto() + ) + }) + } + } + + fn default_instance() -> &'static LinuxWeightDevice { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const LinuxWeightDevice, + }; + unsafe { + instance.get(LinuxWeightDevice::new) + } + } +} + +impl ::protobuf::Clear for LinuxWeightDevice { + fn clear(&mut self) { + self.Major = 0; + self.Minor = 0; + self.Weight = 0; + self.LeafWeight = 0; + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for LinuxWeightDevice { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for LinuxWeightDevice { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct LinuxThrottleDevice { + // message fields + pub Major: i64, + pub Minor: i64, + pub Rate: u64, + // special fields + pub unknown_fields: ::protobuf::UnknownFields, + pub cached_size: ::protobuf::CachedSize, +} + +impl<'a> ::std::default::Default for &'a LinuxThrottleDevice { + fn default() -> &'a LinuxThrottleDevice { + ::default_instance() + } +} + +impl LinuxThrottleDevice { + pub fn new() -> LinuxThrottleDevice { + ::std::default::Default::default() + } + + // int64 Major = 1; + + + pub fn get_Major(&self) -> i64 { + self.Major + } + pub fn clear_Major(&mut self) { + self.Major = 0; + } + + // Param is passed by value, moved + pub fn set_Major(&mut self, v: i64) { + self.Major = v; + } + + // int64 Minor = 2; + + + pub fn get_Minor(&self) -> i64 { + self.Minor + } + pub fn clear_Minor(&mut self) { + self.Minor = 0; + } + + // Param is passed by value, moved + pub fn set_Minor(&mut self, v: i64) { + self.Minor = v; + } + + // uint64 Rate = 3; + + + pub fn get_Rate(&self) -> u64 { + self.Rate + } + pub fn clear_Rate(&mut self) { + self.Rate = 0; + } + + // Param is passed by value, moved + pub fn set_Rate(&mut self, v: u64) { + self.Rate = v; + } +} + +impl ::protobuf::Message for LinuxThrottleDevice { + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_int64()?; + self.Major = tmp; + }, + 2 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_int64()?; + self.Minor = tmp; + }, + 3 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint64()?; + self.Rate = tmp; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if self.Major != 0 { + my_size += ::protobuf::rt::value_size(1, self.Major, ::protobuf::wire_format::WireTypeVarint); + } + if self.Minor != 0 { + my_size += ::protobuf::rt::value_size(2, self.Minor, ::protobuf::wire_format::WireTypeVarint); + } + if self.Rate != 0 { + my_size += ::protobuf::rt::value_size(3, self.Rate, ::protobuf::wire_format::WireTypeVarint); + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if self.Major != 0 { + os.write_int64(1, self.Major)?; + } + if self.Minor != 0 { + os.write_int64(2, self.Minor)?; + } + if self.Rate != 0 { + os.write_uint64(3, self.Rate)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: ::std::boxed::Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> LinuxThrottleDevice { + LinuxThrottleDevice::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeInt64>( + "Major", + |m: &LinuxThrottleDevice| { &m.Major }, + |m: &mut LinuxThrottleDevice| { &mut m.Major }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeInt64>( + "Minor", + |m: &LinuxThrottleDevice| { &m.Minor }, + |m: &mut LinuxThrottleDevice| { &mut m.Minor }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( + "Rate", + |m: &LinuxThrottleDevice| { &m.Rate }, + |m: &mut LinuxThrottleDevice| { &mut m.Rate }, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "LinuxThrottleDevice", + fields, + file_descriptor_proto() + ) + }) + } + } + + fn default_instance() -> &'static LinuxThrottleDevice { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const LinuxThrottleDevice, + }; + unsafe { + instance.get(LinuxThrottleDevice::new) + } + } +} + +impl ::protobuf::Clear for LinuxThrottleDevice { + fn clear(&mut self) { + self.Major = 0; + self.Minor = 0; + self.Rate = 0; + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for LinuxThrottleDevice { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for LinuxThrottleDevice { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct LinuxBlockIO { + // message fields + pub Weight: u32, + pub LeafWeight: u32, + pub WeightDevice: ::protobuf::RepeatedField, + pub ThrottleReadBpsDevice: ::protobuf::RepeatedField, + pub ThrottleWriteBpsDevice: ::protobuf::RepeatedField, + pub ThrottleReadIOPSDevice: ::protobuf::RepeatedField, + pub ThrottleWriteIOPSDevice: ::protobuf::RepeatedField, + // special fields + pub unknown_fields: ::protobuf::UnknownFields, + pub cached_size: ::protobuf::CachedSize, +} + +impl<'a> ::std::default::Default for &'a LinuxBlockIO { + fn default() -> &'a LinuxBlockIO { + ::default_instance() + } +} + +impl LinuxBlockIO { + pub fn new() -> LinuxBlockIO { + ::std::default::Default::default() + } + + // uint32 Weight = 1; + + + pub fn get_Weight(&self) -> u32 { + self.Weight + } + pub fn clear_Weight(&mut self) { + self.Weight = 0; + } + + // Param is passed by value, moved + pub fn set_Weight(&mut self, v: u32) { + self.Weight = v; + } + + // uint32 LeafWeight = 2; + + + pub fn get_LeafWeight(&self) -> u32 { + self.LeafWeight + } + pub fn clear_LeafWeight(&mut self) { + self.LeafWeight = 0; + } + + // Param is passed by value, moved + pub fn set_LeafWeight(&mut self, v: u32) { + self.LeafWeight = v; + } + + // repeated .grpc.LinuxWeightDevice WeightDevice = 3; + + + pub fn get_WeightDevice(&self) -> &[LinuxWeightDevice] { + &self.WeightDevice + } + pub fn clear_WeightDevice(&mut self) { + self.WeightDevice.clear(); + } + + // Param is passed by value, moved + pub fn set_WeightDevice(&mut self, v: ::protobuf::RepeatedField) { + self.WeightDevice = v; + } + + // Mutable pointer to the field. + pub fn mut_WeightDevice(&mut self) -> &mut ::protobuf::RepeatedField { + &mut self.WeightDevice + } + + // Take field + pub fn take_WeightDevice(&mut self) -> ::protobuf::RepeatedField { + ::std::mem::replace(&mut self.WeightDevice, ::protobuf::RepeatedField::new()) + } + + // repeated .grpc.LinuxThrottleDevice ThrottleReadBpsDevice = 4; + + + pub fn get_ThrottleReadBpsDevice(&self) -> &[LinuxThrottleDevice] { + &self.ThrottleReadBpsDevice + } + pub fn clear_ThrottleReadBpsDevice(&mut self) { + self.ThrottleReadBpsDevice.clear(); + } + + // Param is passed by value, moved + pub fn set_ThrottleReadBpsDevice(&mut self, v: ::protobuf::RepeatedField) { + self.ThrottleReadBpsDevice = v; + } + + // Mutable pointer to the field. + pub fn mut_ThrottleReadBpsDevice(&mut self) -> &mut ::protobuf::RepeatedField { + &mut self.ThrottleReadBpsDevice + } + + // Take field + pub fn take_ThrottleReadBpsDevice(&mut self) -> ::protobuf::RepeatedField { + ::std::mem::replace(&mut self.ThrottleReadBpsDevice, ::protobuf::RepeatedField::new()) + } + + // repeated .grpc.LinuxThrottleDevice ThrottleWriteBpsDevice = 5; + + + pub fn get_ThrottleWriteBpsDevice(&self) -> &[LinuxThrottleDevice] { + &self.ThrottleWriteBpsDevice + } + pub fn clear_ThrottleWriteBpsDevice(&mut self) { + self.ThrottleWriteBpsDevice.clear(); + } + + // Param is passed by value, moved + pub fn set_ThrottleWriteBpsDevice(&mut self, v: ::protobuf::RepeatedField) { + self.ThrottleWriteBpsDevice = v; + } + + // Mutable pointer to the field. + pub fn mut_ThrottleWriteBpsDevice(&mut self) -> &mut ::protobuf::RepeatedField { + &mut self.ThrottleWriteBpsDevice + } + + // Take field + pub fn take_ThrottleWriteBpsDevice(&mut self) -> ::protobuf::RepeatedField { + ::std::mem::replace(&mut self.ThrottleWriteBpsDevice, ::protobuf::RepeatedField::new()) + } + + // repeated .grpc.LinuxThrottleDevice ThrottleReadIOPSDevice = 6; + + + pub fn get_ThrottleReadIOPSDevice(&self) -> &[LinuxThrottleDevice] { + &self.ThrottleReadIOPSDevice + } + pub fn clear_ThrottleReadIOPSDevice(&mut self) { + self.ThrottleReadIOPSDevice.clear(); + } + + // Param is passed by value, moved + pub fn set_ThrottleReadIOPSDevice(&mut self, v: ::protobuf::RepeatedField) { + self.ThrottleReadIOPSDevice = v; + } + + // Mutable pointer to the field. + pub fn mut_ThrottleReadIOPSDevice(&mut self) -> &mut ::protobuf::RepeatedField { + &mut self.ThrottleReadIOPSDevice + } + + // Take field + pub fn take_ThrottleReadIOPSDevice(&mut self) -> ::protobuf::RepeatedField { + ::std::mem::replace(&mut self.ThrottleReadIOPSDevice, ::protobuf::RepeatedField::new()) + } + + // repeated .grpc.LinuxThrottleDevice ThrottleWriteIOPSDevice = 7; + + + pub fn get_ThrottleWriteIOPSDevice(&self) -> &[LinuxThrottleDevice] { + &self.ThrottleWriteIOPSDevice + } + pub fn clear_ThrottleWriteIOPSDevice(&mut self) { + self.ThrottleWriteIOPSDevice.clear(); + } + + // Param is passed by value, moved + pub fn set_ThrottleWriteIOPSDevice(&mut self, v: ::protobuf::RepeatedField) { + self.ThrottleWriteIOPSDevice = v; + } + + // Mutable pointer to the field. + pub fn mut_ThrottleWriteIOPSDevice(&mut self) -> &mut ::protobuf::RepeatedField { + &mut self.ThrottleWriteIOPSDevice + } + + // Take field + pub fn take_ThrottleWriteIOPSDevice(&mut self) -> ::protobuf::RepeatedField { + ::std::mem::replace(&mut self.ThrottleWriteIOPSDevice, ::protobuf::RepeatedField::new()) + } +} + +impl ::protobuf::Message for LinuxBlockIO { + fn is_initialized(&self) -> bool { + for v in &self.WeightDevice { + if !v.is_initialized() { + return false; + } + }; + for v in &self.ThrottleReadBpsDevice { + if !v.is_initialized() { + return false; + } + }; + for v in &self.ThrottleWriteBpsDevice { + if !v.is_initialized() { + return false; + } + }; + for v in &self.ThrottleReadIOPSDevice { + if !v.is_initialized() { + return false; + } + }; + for v in &self.ThrottleWriteIOPSDevice { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint32()?; + self.Weight = tmp; + }, + 2 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint32()?; + self.LeafWeight = tmp; + }, + 3 => { + ::protobuf::rt::read_repeated_message_into(wire_type, is, &mut self.WeightDevice)?; + }, + 4 => { + ::protobuf::rt::read_repeated_message_into(wire_type, is, &mut self.ThrottleReadBpsDevice)?; + }, + 5 => { + ::protobuf::rt::read_repeated_message_into(wire_type, is, &mut self.ThrottleWriteBpsDevice)?; + }, + 6 => { + ::protobuf::rt::read_repeated_message_into(wire_type, is, &mut self.ThrottleReadIOPSDevice)?; + }, + 7 => { + ::protobuf::rt::read_repeated_message_into(wire_type, is, &mut self.ThrottleWriteIOPSDevice)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if self.Weight != 0 { + my_size += ::protobuf::rt::value_size(1, self.Weight, ::protobuf::wire_format::WireTypeVarint); + } + if self.LeafWeight != 0 { + my_size += ::protobuf::rt::value_size(2, self.LeafWeight, ::protobuf::wire_format::WireTypeVarint); + } + for value in &self.WeightDevice { + let len = value.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + }; + for value in &self.ThrottleReadBpsDevice { + let len = value.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + }; + for value in &self.ThrottleWriteBpsDevice { + let len = value.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + }; + for value in &self.ThrottleReadIOPSDevice { + let len = value.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + }; + for value in &self.ThrottleWriteIOPSDevice { + let len = value.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + }; + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if self.Weight != 0 { + os.write_uint32(1, self.Weight)?; + } + if self.LeafWeight != 0 { + os.write_uint32(2, self.LeafWeight)?; + } + for v in &self.WeightDevice { + os.write_tag(3, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + }; + for v in &self.ThrottleReadBpsDevice { + os.write_tag(4, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + }; + for v in &self.ThrottleWriteBpsDevice { + os.write_tag(5, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + }; + for v in &self.ThrottleReadIOPSDevice { + os.write_tag(6, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + }; + for v in &self.ThrottleWriteIOPSDevice { + os.write_tag(7, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + }; + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: ::std::boxed::Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> LinuxBlockIO { + LinuxBlockIO::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint32>( + "Weight", + |m: &LinuxBlockIO| { &m.Weight }, + |m: &mut LinuxBlockIO| { &mut m.Weight }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint32>( + "LeafWeight", + |m: &LinuxBlockIO| { &m.LeafWeight }, + |m: &mut LinuxBlockIO| { &mut m.LeafWeight }, + )); + fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "WeightDevice", + |m: &LinuxBlockIO| { &m.WeightDevice }, + |m: &mut LinuxBlockIO| { &mut m.WeightDevice }, + )); + fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "ThrottleReadBpsDevice", + |m: &LinuxBlockIO| { &m.ThrottleReadBpsDevice }, + |m: &mut LinuxBlockIO| { &mut m.ThrottleReadBpsDevice }, + )); + fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "ThrottleWriteBpsDevice", + |m: &LinuxBlockIO| { &m.ThrottleWriteBpsDevice }, + |m: &mut LinuxBlockIO| { &mut m.ThrottleWriteBpsDevice }, + )); + fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "ThrottleReadIOPSDevice", + |m: &LinuxBlockIO| { &m.ThrottleReadIOPSDevice }, + |m: &mut LinuxBlockIO| { &mut m.ThrottleReadIOPSDevice }, + )); + fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "ThrottleWriteIOPSDevice", + |m: &LinuxBlockIO| { &m.ThrottleWriteIOPSDevice }, + |m: &mut LinuxBlockIO| { &mut m.ThrottleWriteIOPSDevice }, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "LinuxBlockIO", + fields, + file_descriptor_proto() + ) + }) + } + } + + fn default_instance() -> &'static LinuxBlockIO { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const LinuxBlockIO, + }; + unsafe { + instance.get(LinuxBlockIO::new) + } + } +} + +impl ::protobuf::Clear for LinuxBlockIO { + fn clear(&mut self) { + self.Weight = 0; + self.LeafWeight = 0; + self.WeightDevice.clear(); + self.ThrottleReadBpsDevice.clear(); + self.ThrottleWriteBpsDevice.clear(); + self.ThrottleReadIOPSDevice.clear(); + self.ThrottleWriteIOPSDevice.clear(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for LinuxBlockIO { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for LinuxBlockIO { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct LinuxPids { + // message fields + pub Limit: i64, + // special fields + pub unknown_fields: ::protobuf::UnknownFields, + pub cached_size: ::protobuf::CachedSize, +} + +impl<'a> ::std::default::Default for &'a LinuxPids { + fn default() -> &'a LinuxPids { + ::default_instance() + } +} + +impl LinuxPids { + pub fn new() -> LinuxPids { + ::std::default::Default::default() + } + + // int64 Limit = 1; + + + pub fn get_Limit(&self) -> i64 { + self.Limit + } + pub fn clear_Limit(&mut self) { + self.Limit = 0; + } + + // Param is passed by value, moved + pub fn set_Limit(&mut self, v: i64) { + self.Limit = v; + } +} + +impl ::protobuf::Message for LinuxPids { + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_int64()?; + self.Limit = tmp; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if self.Limit != 0 { + my_size += ::protobuf::rt::value_size(1, self.Limit, ::protobuf::wire_format::WireTypeVarint); + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if self.Limit != 0 { + os.write_int64(1, self.Limit)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: ::std::boxed::Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> LinuxPids { + LinuxPids::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeInt64>( + "Limit", + |m: &LinuxPids| { &m.Limit }, + |m: &mut LinuxPids| { &mut m.Limit }, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "LinuxPids", + fields, + file_descriptor_proto() + ) + }) + } + } + + fn default_instance() -> &'static LinuxPids { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const LinuxPids, + }; + unsafe { + instance.get(LinuxPids::new) + } + } +} + +impl ::protobuf::Clear for LinuxPids { + fn clear(&mut self) { + self.Limit = 0; + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for LinuxPids { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for LinuxPids { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct LinuxDeviceCgroup { + // message fields + pub Allow: bool, + pub Type: ::std::string::String, + pub Major: i64, + pub Minor: i64, + pub Access: ::std::string::String, + // special fields + pub unknown_fields: ::protobuf::UnknownFields, + pub cached_size: ::protobuf::CachedSize, +} + +impl<'a> ::std::default::Default for &'a LinuxDeviceCgroup { + fn default() -> &'a LinuxDeviceCgroup { + ::default_instance() + } +} + +impl LinuxDeviceCgroup { + pub fn new() -> LinuxDeviceCgroup { + ::std::default::Default::default() + } + + // bool Allow = 1; + + + pub fn get_Allow(&self) -> bool { + self.Allow + } + pub fn clear_Allow(&mut self) { + self.Allow = false; + } + + // Param is passed by value, moved + pub fn set_Allow(&mut self, v: bool) { + self.Allow = v; + } + + // string Type = 2; + + + pub fn get_Type(&self) -> &str { + &self.Type + } + pub fn clear_Type(&mut self) { + self.Type.clear(); + } + + // Param is passed by value, moved + pub fn set_Type(&mut self, v: ::std::string::String) { + self.Type = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_Type(&mut self) -> &mut ::std::string::String { + &mut self.Type + } + + // Take field + pub fn take_Type(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.Type, ::std::string::String::new()) + } + + // int64 Major = 3; + + + pub fn get_Major(&self) -> i64 { + self.Major + } + pub fn clear_Major(&mut self) { + self.Major = 0; + } + + // Param is passed by value, moved + pub fn set_Major(&mut self, v: i64) { + self.Major = v; + } + + // int64 Minor = 4; + + + pub fn get_Minor(&self) -> i64 { + self.Minor + } + pub fn clear_Minor(&mut self) { + self.Minor = 0; + } + + // Param is passed by value, moved + pub fn set_Minor(&mut self, v: i64) { + self.Minor = v; + } + + // string Access = 5; + + + pub fn get_Access(&self) -> &str { + &self.Access + } + pub fn clear_Access(&mut self) { + self.Access.clear(); + } + + // Param is passed by value, moved + pub fn set_Access(&mut self, v: ::std::string::String) { + self.Access = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_Access(&mut self) -> &mut ::std::string::String { + &mut self.Access + } + + // Take field + pub fn take_Access(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.Access, ::std::string::String::new()) + } +} + +impl ::protobuf::Message for LinuxDeviceCgroup { + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_bool()?; + self.Allow = tmp; + }, + 2 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.Type)?; + }, + 3 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_int64()?; + self.Major = tmp; + }, + 4 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_int64()?; + self.Minor = tmp; + }, + 5 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.Access)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if self.Allow != false { + my_size += 2; + } + if !self.Type.is_empty() { + my_size += ::protobuf::rt::string_size(2, &self.Type); + } + if self.Major != 0 { + my_size += ::protobuf::rt::value_size(3, self.Major, ::protobuf::wire_format::WireTypeVarint); + } + if self.Minor != 0 { + my_size += ::protobuf::rt::value_size(4, self.Minor, ::protobuf::wire_format::WireTypeVarint); + } + if !self.Access.is_empty() { + my_size += ::protobuf::rt::string_size(5, &self.Access); + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if self.Allow != false { + os.write_bool(1, self.Allow)?; + } + if !self.Type.is_empty() { + os.write_string(2, &self.Type)?; + } + if self.Major != 0 { + os.write_int64(3, self.Major)?; + } + if self.Minor != 0 { + os.write_int64(4, self.Minor)?; + } + if !self.Access.is_empty() { + os.write_string(5, &self.Access)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: ::std::boxed::Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> LinuxDeviceCgroup { + LinuxDeviceCgroup::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeBool>( + "Allow", + |m: &LinuxDeviceCgroup| { &m.Allow }, + |m: &mut LinuxDeviceCgroup| { &mut m.Allow }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "Type", + |m: &LinuxDeviceCgroup| { &m.Type }, + |m: &mut LinuxDeviceCgroup| { &mut m.Type }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeInt64>( + "Major", + |m: &LinuxDeviceCgroup| { &m.Major }, + |m: &mut LinuxDeviceCgroup| { &mut m.Major }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeInt64>( + "Minor", + |m: &LinuxDeviceCgroup| { &m.Minor }, + |m: &mut LinuxDeviceCgroup| { &mut m.Minor }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "Access", + |m: &LinuxDeviceCgroup| { &m.Access }, + |m: &mut LinuxDeviceCgroup| { &mut m.Access }, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "LinuxDeviceCgroup", + fields, + file_descriptor_proto() + ) + }) + } + } + + fn default_instance() -> &'static LinuxDeviceCgroup { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const LinuxDeviceCgroup, + }; + unsafe { + instance.get(LinuxDeviceCgroup::new) + } + } +} + +impl ::protobuf::Clear for LinuxDeviceCgroup { + fn clear(&mut self) { + self.Allow = false; + self.Type.clear(); + self.Major = 0; + self.Minor = 0; + self.Access.clear(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for LinuxDeviceCgroup { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for LinuxDeviceCgroup { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct LinuxNetwork { + // message fields + pub ClassID: u32, + pub Priorities: ::protobuf::RepeatedField, + // special fields + pub unknown_fields: ::protobuf::UnknownFields, + pub cached_size: ::protobuf::CachedSize, +} + +impl<'a> ::std::default::Default for &'a LinuxNetwork { + fn default() -> &'a LinuxNetwork { + ::default_instance() + } +} + +impl LinuxNetwork { + pub fn new() -> LinuxNetwork { + ::std::default::Default::default() + } + + // uint32 ClassID = 1; + + + pub fn get_ClassID(&self) -> u32 { + self.ClassID + } + pub fn clear_ClassID(&mut self) { + self.ClassID = 0; + } + + // Param is passed by value, moved + pub fn set_ClassID(&mut self, v: u32) { + self.ClassID = v; + } + + // repeated .grpc.LinuxInterfacePriority Priorities = 2; + + + pub fn get_Priorities(&self) -> &[LinuxInterfacePriority] { + &self.Priorities + } + pub fn clear_Priorities(&mut self) { + self.Priorities.clear(); + } + + // Param is passed by value, moved + pub fn set_Priorities(&mut self, v: ::protobuf::RepeatedField) { + self.Priorities = v; + } + + // Mutable pointer to the field. + pub fn mut_Priorities(&mut self) -> &mut ::protobuf::RepeatedField { + &mut self.Priorities + } + + // Take field + pub fn take_Priorities(&mut self) -> ::protobuf::RepeatedField { + ::std::mem::replace(&mut self.Priorities, ::protobuf::RepeatedField::new()) + } +} + +impl ::protobuf::Message for LinuxNetwork { + fn is_initialized(&self) -> bool { + for v in &self.Priorities { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint32()?; + self.ClassID = tmp; + }, + 2 => { + ::protobuf::rt::read_repeated_message_into(wire_type, is, &mut self.Priorities)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if self.ClassID != 0 { + my_size += ::protobuf::rt::value_size(1, self.ClassID, ::protobuf::wire_format::WireTypeVarint); + } + for value in &self.Priorities { + let len = value.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + }; + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if self.ClassID != 0 { + os.write_uint32(1, self.ClassID)?; + } + for v in &self.Priorities { + os.write_tag(2, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + }; + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: ::std::boxed::Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> LinuxNetwork { + LinuxNetwork::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint32>( + "ClassID", + |m: &LinuxNetwork| { &m.ClassID }, + |m: &mut LinuxNetwork| { &mut m.ClassID }, + )); + fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "Priorities", + |m: &LinuxNetwork| { &m.Priorities }, + |m: &mut LinuxNetwork| { &mut m.Priorities }, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "LinuxNetwork", + fields, + file_descriptor_proto() + ) + }) + } + } + + fn default_instance() -> &'static LinuxNetwork { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const LinuxNetwork, + }; + unsafe { + instance.get(LinuxNetwork::new) + } + } +} + +impl ::protobuf::Clear for LinuxNetwork { + fn clear(&mut self) { + self.ClassID = 0; + self.Priorities.clear(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for LinuxNetwork { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for LinuxNetwork { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct LinuxHugepageLimit { + // message fields + pub Pagesize: ::std::string::String, + pub Limit: u64, + // special fields + pub unknown_fields: ::protobuf::UnknownFields, + pub cached_size: ::protobuf::CachedSize, +} + +impl<'a> ::std::default::Default for &'a LinuxHugepageLimit { + fn default() -> &'a LinuxHugepageLimit { + ::default_instance() + } +} + +impl LinuxHugepageLimit { + pub fn new() -> LinuxHugepageLimit { + ::std::default::Default::default() + } + + // string Pagesize = 1; + + + pub fn get_Pagesize(&self) -> &str { + &self.Pagesize + } + pub fn clear_Pagesize(&mut self) { + self.Pagesize.clear(); + } + + // Param is passed by value, moved + pub fn set_Pagesize(&mut self, v: ::std::string::String) { + self.Pagesize = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_Pagesize(&mut self) -> &mut ::std::string::String { + &mut self.Pagesize + } + + // Take field + pub fn take_Pagesize(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.Pagesize, ::std::string::String::new()) + } + + // uint64 Limit = 2; + + + pub fn get_Limit(&self) -> u64 { + self.Limit + } + pub fn clear_Limit(&mut self) { + self.Limit = 0; + } + + // Param is passed by value, moved + pub fn set_Limit(&mut self, v: u64) { + self.Limit = v; + } +} + +impl ::protobuf::Message for LinuxHugepageLimit { + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.Pagesize)?; + }, + 2 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint64()?; + self.Limit = tmp; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if !self.Pagesize.is_empty() { + my_size += ::protobuf::rt::string_size(1, &self.Pagesize); + } + if self.Limit != 0 { + my_size += ::protobuf::rt::value_size(2, self.Limit, ::protobuf::wire_format::WireTypeVarint); + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if !self.Pagesize.is_empty() { + os.write_string(1, &self.Pagesize)?; + } + if self.Limit != 0 { + os.write_uint64(2, self.Limit)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: ::std::boxed::Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> LinuxHugepageLimit { + LinuxHugepageLimit::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "Pagesize", + |m: &LinuxHugepageLimit| { &m.Pagesize }, + |m: &mut LinuxHugepageLimit| { &mut m.Pagesize }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( + "Limit", + |m: &LinuxHugepageLimit| { &m.Limit }, + |m: &mut LinuxHugepageLimit| { &mut m.Limit }, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "LinuxHugepageLimit", + fields, + file_descriptor_proto() + ) + }) + } + } + + fn default_instance() -> &'static LinuxHugepageLimit { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const LinuxHugepageLimit, + }; + unsafe { + instance.get(LinuxHugepageLimit::new) + } + } +} + +impl ::protobuf::Clear for LinuxHugepageLimit { + fn clear(&mut self) { + self.Pagesize.clear(); + self.Limit = 0; + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for LinuxHugepageLimit { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for LinuxHugepageLimit { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct LinuxInterfacePriority { + // message fields + pub Name: ::std::string::String, + pub Priority: u32, + // special fields + pub unknown_fields: ::protobuf::UnknownFields, + pub cached_size: ::protobuf::CachedSize, +} + +impl<'a> ::std::default::Default for &'a LinuxInterfacePriority { + fn default() -> &'a LinuxInterfacePriority { + ::default_instance() + } +} + +impl LinuxInterfacePriority { + pub fn new() -> LinuxInterfacePriority { + ::std::default::Default::default() + } + + // string Name = 1; + + + pub fn get_Name(&self) -> &str { + &self.Name + } + pub fn clear_Name(&mut self) { + self.Name.clear(); + } + + // Param is passed by value, moved + pub fn set_Name(&mut self, v: ::std::string::String) { + self.Name = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_Name(&mut self) -> &mut ::std::string::String { + &mut self.Name + } + + // Take field + pub fn take_Name(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.Name, ::std::string::String::new()) + } + + // uint32 Priority = 2; + + + pub fn get_Priority(&self) -> u32 { + self.Priority + } + pub fn clear_Priority(&mut self) { + self.Priority = 0; + } + + // Param is passed by value, moved + pub fn set_Priority(&mut self, v: u32) { + self.Priority = v; + } +} + +impl ::protobuf::Message for LinuxInterfacePriority { + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.Name)?; + }, + 2 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint32()?; + self.Priority = tmp; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if !self.Name.is_empty() { + my_size += ::protobuf::rt::string_size(1, &self.Name); + } + if self.Priority != 0 { + my_size += ::protobuf::rt::value_size(2, self.Priority, ::protobuf::wire_format::WireTypeVarint); + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if !self.Name.is_empty() { + os.write_string(1, &self.Name)?; + } + if self.Priority != 0 { + os.write_uint32(2, self.Priority)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: ::std::boxed::Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> LinuxInterfacePriority { + LinuxInterfacePriority::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "Name", + |m: &LinuxInterfacePriority| { &m.Name }, + |m: &mut LinuxInterfacePriority| { &mut m.Name }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint32>( + "Priority", + |m: &LinuxInterfacePriority| { &m.Priority }, + |m: &mut LinuxInterfacePriority| { &mut m.Priority }, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "LinuxInterfacePriority", + fields, + file_descriptor_proto() + ) + }) + } + } + + fn default_instance() -> &'static LinuxInterfacePriority { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const LinuxInterfacePriority, + }; + unsafe { + instance.get(LinuxInterfacePriority::new) + } + } +} + +impl ::protobuf::Clear for LinuxInterfacePriority { + fn clear(&mut self) { + self.Name.clear(); + self.Priority = 0; + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for LinuxInterfacePriority { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for LinuxInterfacePriority { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct LinuxSeccomp { + // message fields + pub DefaultAction: ::std::string::String, + pub Architectures: ::protobuf::RepeatedField<::std::string::String>, + pub Syscalls: ::protobuf::RepeatedField, + // special fields + pub unknown_fields: ::protobuf::UnknownFields, + pub cached_size: ::protobuf::CachedSize, +} + +impl<'a> ::std::default::Default for &'a LinuxSeccomp { + fn default() -> &'a LinuxSeccomp { + ::default_instance() + } +} + +impl LinuxSeccomp { + pub fn new() -> LinuxSeccomp { + ::std::default::Default::default() + } + + // string DefaultAction = 1; + + + pub fn get_DefaultAction(&self) -> &str { + &self.DefaultAction + } + pub fn clear_DefaultAction(&mut self) { + self.DefaultAction.clear(); + } + + // Param is passed by value, moved + pub fn set_DefaultAction(&mut self, v: ::std::string::String) { + self.DefaultAction = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_DefaultAction(&mut self) -> &mut ::std::string::String { + &mut self.DefaultAction + } + + // Take field + pub fn take_DefaultAction(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.DefaultAction, ::std::string::String::new()) + } + + // repeated string Architectures = 2; + + + pub fn get_Architectures(&self) -> &[::std::string::String] { + &self.Architectures + } + pub fn clear_Architectures(&mut self) { + self.Architectures.clear(); + } + + // Param is passed by value, moved + pub fn set_Architectures(&mut self, v: ::protobuf::RepeatedField<::std::string::String>) { + self.Architectures = v; + } + + // Mutable pointer to the field. + pub fn mut_Architectures(&mut self) -> &mut ::protobuf::RepeatedField<::std::string::String> { + &mut self.Architectures + } + + // Take field + pub fn take_Architectures(&mut self) -> ::protobuf::RepeatedField<::std::string::String> { + ::std::mem::replace(&mut self.Architectures, ::protobuf::RepeatedField::new()) + } + + // repeated .grpc.LinuxSyscall Syscalls = 3; + + + pub fn get_Syscalls(&self) -> &[LinuxSyscall] { + &self.Syscalls + } + pub fn clear_Syscalls(&mut self) { + self.Syscalls.clear(); + } + + // Param is passed by value, moved + pub fn set_Syscalls(&mut self, v: ::protobuf::RepeatedField) { + self.Syscalls = v; + } + + // Mutable pointer to the field. + pub fn mut_Syscalls(&mut self) -> &mut ::protobuf::RepeatedField { + &mut self.Syscalls + } + + // Take field + pub fn take_Syscalls(&mut self) -> ::protobuf::RepeatedField { + ::std::mem::replace(&mut self.Syscalls, ::protobuf::RepeatedField::new()) + } +} + +impl ::protobuf::Message for LinuxSeccomp { + fn is_initialized(&self) -> bool { + for v in &self.Syscalls { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.DefaultAction)?; + }, + 2 => { + ::protobuf::rt::read_repeated_string_into(wire_type, is, &mut self.Architectures)?; + }, + 3 => { + ::protobuf::rt::read_repeated_message_into(wire_type, is, &mut self.Syscalls)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if !self.DefaultAction.is_empty() { + my_size += ::protobuf::rt::string_size(1, &self.DefaultAction); + } + for value in &self.Architectures { + my_size += ::protobuf::rt::string_size(2, &value); + }; + for value in &self.Syscalls { + let len = value.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + }; + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if !self.DefaultAction.is_empty() { + os.write_string(1, &self.DefaultAction)?; + } + for v in &self.Architectures { + os.write_string(2, &v)?; + }; + for v in &self.Syscalls { + os.write_tag(3, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + }; + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: ::std::boxed::Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> LinuxSeccomp { + LinuxSeccomp::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "DefaultAction", + |m: &LinuxSeccomp| { &m.DefaultAction }, + |m: &mut LinuxSeccomp| { &mut m.DefaultAction }, + )); + fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "Architectures", + |m: &LinuxSeccomp| { &m.Architectures }, + |m: &mut LinuxSeccomp| { &mut m.Architectures }, + )); + fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "Syscalls", + |m: &LinuxSeccomp| { &m.Syscalls }, + |m: &mut LinuxSeccomp| { &mut m.Syscalls }, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "LinuxSeccomp", + fields, + file_descriptor_proto() + ) + }) + } + } + + fn default_instance() -> &'static LinuxSeccomp { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const LinuxSeccomp, + }; + unsafe { + instance.get(LinuxSeccomp::new) + } + } +} + +impl ::protobuf::Clear for LinuxSeccomp { + fn clear(&mut self) { + self.DefaultAction.clear(); + self.Architectures.clear(); + self.Syscalls.clear(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for LinuxSeccomp { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for LinuxSeccomp { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct LinuxSeccompArg { + // message fields + pub Index: u64, + pub Value: u64, + pub ValueTwo: u64, + pub Op: ::std::string::String, + // special fields + pub unknown_fields: ::protobuf::UnknownFields, + pub cached_size: ::protobuf::CachedSize, +} + +impl<'a> ::std::default::Default for &'a LinuxSeccompArg { + fn default() -> &'a LinuxSeccompArg { + ::default_instance() + } +} + +impl LinuxSeccompArg { + pub fn new() -> LinuxSeccompArg { + ::std::default::Default::default() + } + + // uint64 Index = 1; + + + pub fn get_Index(&self) -> u64 { + self.Index + } + pub fn clear_Index(&mut self) { + self.Index = 0; + } + + // Param is passed by value, moved + pub fn set_Index(&mut self, v: u64) { + self.Index = v; + } + + // uint64 Value = 2; + + + pub fn get_Value(&self) -> u64 { + self.Value + } + pub fn clear_Value(&mut self) { + self.Value = 0; + } + + // Param is passed by value, moved + pub fn set_Value(&mut self, v: u64) { + self.Value = v; + } + + // uint64 ValueTwo = 3; + + + pub fn get_ValueTwo(&self) -> u64 { + self.ValueTwo + } + pub fn clear_ValueTwo(&mut self) { + self.ValueTwo = 0; + } + + // Param is passed by value, moved + pub fn set_ValueTwo(&mut self, v: u64) { + self.ValueTwo = v; + } + + // string Op = 4; + + + pub fn get_Op(&self) -> &str { + &self.Op + } + pub fn clear_Op(&mut self) { + self.Op.clear(); + } + + // Param is passed by value, moved + pub fn set_Op(&mut self, v: ::std::string::String) { + self.Op = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_Op(&mut self) -> &mut ::std::string::String { + &mut self.Op + } + + // Take field + pub fn take_Op(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.Op, ::std::string::String::new()) + } +} + +impl ::protobuf::Message for LinuxSeccompArg { + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint64()?; + self.Index = tmp; + }, + 2 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint64()?; + self.Value = tmp; + }, + 3 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint64()?; + self.ValueTwo = tmp; + }, + 4 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.Op)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if self.Index != 0 { + my_size += ::protobuf::rt::value_size(1, self.Index, ::protobuf::wire_format::WireTypeVarint); + } + if self.Value != 0 { + my_size += ::protobuf::rt::value_size(2, self.Value, ::protobuf::wire_format::WireTypeVarint); + } + if self.ValueTwo != 0 { + my_size += ::protobuf::rt::value_size(3, self.ValueTwo, ::protobuf::wire_format::WireTypeVarint); + } + if !self.Op.is_empty() { + my_size += ::protobuf::rt::string_size(4, &self.Op); + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if self.Index != 0 { + os.write_uint64(1, self.Index)?; + } + if self.Value != 0 { + os.write_uint64(2, self.Value)?; + } + if self.ValueTwo != 0 { + os.write_uint64(3, self.ValueTwo)?; + } + if !self.Op.is_empty() { + os.write_string(4, &self.Op)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: ::std::boxed::Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> LinuxSeccompArg { + LinuxSeccompArg::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( + "Index", + |m: &LinuxSeccompArg| { &m.Index }, + |m: &mut LinuxSeccompArg| { &mut m.Index }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( + "Value", + |m: &LinuxSeccompArg| { &m.Value }, + |m: &mut LinuxSeccompArg| { &mut m.Value }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( + "ValueTwo", + |m: &LinuxSeccompArg| { &m.ValueTwo }, + |m: &mut LinuxSeccompArg| { &mut m.ValueTwo }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "Op", + |m: &LinuxSeccompArg| { &m.Op }, + |m: &mut LinuxSeccompArg| { &mut m.Op }, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "LinuxSeccompArg", + fields, + file_descriptor_proto() + ) + }) + } + } + + fn default_instance() -> &'static LinuxSeccompArg { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const LinuxSeccompArg, + }; + unsafe { + instance.get(LinuxSeccompArg::new) + } + } +} + +impl ::protobuf::Clear for LinuxSeccompArg { + fn clear(&mut self) { + self.Index = 0; + self.Value = 0; + self.ValueTwo = 0; + self.Op.clear(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for LinuxSeccompArg { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for LinuxSeccompArg { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct LinuxSyscall { + // message fields + pub Names: ::protobuf::RepeatedField<::std::string::String>, + pub Action: ::std::string::String, + pub Args: ::protobuf::RepeatedField, + // special fields + pub unknown_fields: ::protobuf::UnknownFields, + pub cached_size: ::protobuf::CachedSize, +} + +impl<'a> ::std::default::Default for &'a LinuxSyscall { + fn default() -> &'a LinuxSyscall { + ::default_instance() + } +} + +impl LinuxSyscall { + pub fn new() -> LinuxSyscall { + ::std::default::Default::default() + } + + // repeated string Names = 1; + + + pub fn get_Names(&self) -> &[::std::string::String] { + &self.Names + } + pub fn clear_Names(&mut self) { + self.Names.clear(); + } + + // Param is passed by value, moved + pub fn set_Names(&mut self, v: ::protobuf::RepeatedField<::std::string::String>) { + self.Names = v; + } + + // Mutable pointer to the field. + pub fn mut_Names(&mut self) -> &mut ::protobuf::RepeatedField<::std::string::String> { + &mut self.Names + } + + // Take field + pub fn take_Names(&mut self) -> ::protobuf::RepeatedField<::std::string::String> { + ::std::mem::replace(&mut self.Names, ::protobuf::RepeatedField::new()) + } + + // string Action = 2; + + + pub fn get_Action(&self) -> &str { + &self.Action + } + pub fn clear_Action(&mut self) { + self.Action.clear(); + } + + // Param is passed by value, moved + pub fn set_Action(&mut self, v: ::std::string::String) { + self.Action = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_Action(&mut self) -> &mut ::std::string::String { + &mut self.Action + } + + // Take field + pub fn take_Action(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.Action, ::std::string::String::new()) + } + + // repeated .grpc.LinuxSeccompArg Args = 3; + + + pub fn get_Args(&self) -> &[LinuxSeccompArg] { + &self.Args + } + pub fn clear_Args(&mut self) { + self.Args.clear(); + } + + // Param is passed by value, moved + pub fn set_Args(&mut self, v: ::protobuf::RepeatedField) { + self.Args = v; + } + + // Mutable pointer to the field. + pub fn mut_Args(&mut self) -> &mut ::protobuf::RepeatedField { + &mut self.Args + } + + // Take field + pub fn take_Args(&mut self) -> ::protobuf::RepeatedField { + ::std::mem::replace(&mut self.Args, ::protobuf::RepeatedField::new()) + } +} + +impl ::protobuf::Message for LinuxSyscall { + fn is_initialized(&self) -> bool { + for v in &self.Args { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_repeated_string_into(wire_type, is, &mut self.Names)?; + }, + 2 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.Action)?; + }, + 3 => { + ::protobuf::rt::read_repeated_message_into(wire_type, is, &mut self.Args)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + for value in &self.Names { + my_size += ::protobuf::rt::string_size(1, &value); + }; + if !self.Action.is_empty() { + my_size += ::protobuf::rt::string_size(2, &self.Action); + } + for value in &self.Args { + let len = value.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + }; + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + for v in &self.Names { + os.write_string(1, &v)?; + }; + if !self.Action.is_empty() { + os.write_string(2, &self.Action)?; + } + for v in &self.Args { + os.write_tag(3, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + }; + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: ::std::boxed::Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> LinuxSyscall { + LinuxSyscall::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "Names", + |m: &LinuxSyscall| { &m.Names }, + |m: &mut LinuxSyscall| { &mut m.Names }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "Action", + |m: &LinuxSyscall| { &m.Action }, + |m: &mut LinuxSyscall| { &mut m.Action }, + )); + fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "Args", + |m: &LinuxSyscall| { &m.Args }, + |m: &mut LinuxSyscall| { &mut m.Args }, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "LinuxSyscall", + fields, + file_descriptor_proto() + ) + }) + } + } + + fn default_instance() -> &'static LinuxSyscall { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const LinuxSyscall, + }; + unsafe { + instance.get(LinuxSyscall::new) + } + } +} + +impl ::protobuf::Clear for LinuxSyscall { + fn clear(&mut self) { + self.Names.clear(); + self.Action.clear(); + self.Args.clear(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for LinuxSyscall { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for LinuxSyscall { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct LinuxIntelRdt { + // message fields + pub L3CacheSchema: ::std::string::String, + // special fields + pub unknown_fields: ::protobuf::UnknownFields, + pub cached_size: ::protobuf::CachedSize, +} + +impl<'a> ::std::default::Default for &'a LinuxIntelRdt { + fn default() -> &'a LinuxIntelRdt { + ::default_instance() + } +} + +impl LinuxIntelRdt { + pub fn new() -> LinuxIntelRdt { + ::std::default::Default::default() + } + + // string L3CacheSchema = 1; + + + pub fn get_L3CacheSchema(&self) -> &str { + &self.L3CacheSchema + } + pub fn clear_L3CacheSchema(&mut self) { + self.L3CacheSchema.clear(); + } + + // Param is passed by value, moved + pub fn set_L3CacheSchema(&mut self, v: ::std::string::String) { + self.L3CacheSchema = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_L3CacheSchema(&mut self) -> &mut ::std::string::String { + &mut self.L3CacheSchema + } + + // Take field + pub fn take_L3CacheSchema(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.L3CacheSchema, ::std::string::String::new()) + } +} + +impl ::protobuf::Message for LinuxIntelRdt { + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.L3CacheSchema)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if !self.L3CacheSchema.is_empty() { + my_size += ::protobuf::rt::string_size(1, &self.L3CacheSchema); + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if !self.L3CacheSchema.is_empty() { + os.write_string(1, &self.L3CacheSchema)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: ::std::boxed::Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> LinuxIntelRdt { + LinuxIntelRdt::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "L3CacheSchema", + |m: &LinuxIntelRdt| { &m.L3CacheSchema }, + |m: &mut LinuxIntelRdt| { &mut m.L3CacheSchema }, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "LinuxIntelRdt", + fields, + file_descriptor_proto() + ) + }) + } + } + + fn default_instance() -> &'static LinuxIntelRdt { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const LinuxIntelRdt, + }; + unsafe { + instance.get(LinuxIntelRdt::new) + } + } +} + +impl ::protobuf::Clear for LinuxIntelRdt { + fn clear(&mut self) { + self.L3CacheSchema.clear(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for LinuxIntelRdt { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for LinuxIntelRdt { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +static file_descriptor_proto_data: &'static [u8] = b"\ + \n\toci.proto\x12\x04grpc\x1a-github.com/gogo/protobuf/gogoproto/gogo.pr\ + oto\x1a\x1egoogle/protobuf/wrappers.proto\"\xc7\x03\n\x04Spec\x12\x18\n\ + \x07Version\x18\x01\x20\x01(\tR\x07Version\x12'\n\x07Process\x18\x02\x20\ + \x01(\x0b2\r.grpc.ProcessR\x07Process\x12\x1e\n\x04Root\x18\x03\x20\x01(\ + \x0b2\n.grpc.RootR\x04Root\x12\x1a\n\x08Hostname\x18\x04\x20\x01(\tR\x08\ + Hostname\x12)\n\x06Mounts\x18\x05\x20\x03(\x0b2\x0b.grpc.MountR\x06Mount\ + sB\x04\xc8\xde\x1f\0\x12!\n\x05Hooks\x18\x06\x20\x01(\x0b2\x0b.grpc.Hook\ + sR\x05Hooks\x12=\n\x0bAnnotations\x18\x07\x20\x03(\x0b2\x1b.grpc.Spec.An\ + notationsEntryR\x0bAnnotations\x12!\n\x05Linux\x18\x08\x20\x01(\x0b2\x0b\ + .grpc.LinuxR\x05Linux\x12'\n\x07Solaris\x18\t\x20\x01(\x0b2\r.grpc.Solar\ + isR\x07Solaris\x12'\n\x07Windows\x18\n\x20\x01(\x0b2\r.grpc.WindowsR\x07\ + Windows\x1a>\n\x10AnnotationsEntry\x12\x10\n\x03key\x18\x01\x20\x01(\tR\ + \x03key\x12\x14\n\x05value\x18\x02\x20\x01(\tR\x05value:\x028\x01\"\xba\ + \x03\n\x07Process\x12\x1a\n\x08Terminal\x18\x01\x20\x01(\x08R\x08Termina\ + l\x12+\n\x0bConsoleSize\x18\x02\x20\x01(\x0b2\t.grpc.BoxR\x0bConsoleSize\ + \x12$\n\x04User\x18\x03\x20\x01(\x0b2\n.grpc.UserR\x04UserB\x04\xc8\xde\ + \x1f\0\x12\x12\n\x04Args\x18\x04\x20\x03(\tR\x04Args\x12\x10\n\x03Env\ + \x18\x05\x20\x03(\tR\x03Env\x12\x10\n\x03Cwd\x18\x06\x20\x01(\tR\x03Cwd\ + \x12;\n\x0cCapabilities\x18\x07\x20\x01(\x0b2\x17.grpc.LinuxCapabilities\ + R\x0cCapabilities\x121\n\x07Rlimits\x18\x08\x20\x03(\x0b2\x11.grpc.POSIX\ + RlimitR\x07RlimitsB\x04\xc8\xde\x1f\0\x12(\n\x0fNoNewPrivileges\x18\t\ + \x20\x01(\x08R\x0fNoNewPrivileges\x12(\n\x0fApparmorProfile\x18\n\x20\ + \x01(\tR\x0fApparmorProfile\x12\x20\n\x0bOOMScoreAdj\x18\x0b\x20\x01(\ + \x03R\x0bOOMScoreAdj\x12\"\n\x0cSelinuxLabel\x18\x0c\x20\x01(\tR\x0cSeli\ + nuxLabel\"3\n\x03Box\x12\x16\n\x06Height\x18\x01\x20\x01(\rR\x06Height\ + \x12\x14\n\x05Width\x18\x02\x20\x01(\rR\x05Width\"n\n\x04User\x12\x10\n\ + \x03UID\x18\x01\x20\x01(\rR\x03UID\x12\x10\n\x03GID\x18\x02\x20\x01(\rR\ + \x03GID\x12&\n\x0eAdditionalGids\x18\x03\x20\x03(\rR\x0eAdditionalGids\ + \x12\x1a\n\x08Username\x18\x04\x20\x01(\tR\x08Username\"\xa7\x01\n\x11Li\ + nuxCapabilities\x12\x1a\n\x08Bounding\x18\x01\x20\x03(\tR\x08Bounding\ + \x12\x1c\n\tEffective\x18\x02\x20\x03(\tR\tEffective\x12\x20\n\x0bInheri\ + table\x18\x03\x20\x03(\tR\x0bInheritable\x12\x1c\n\tPermitted\x18\x04\ + \x20\x03(\tR\tPermitted\x12\x18\n\x07Ambient\x18\x05\x20\x03(\tR\x07Ambi\ + ent\"I\n\x0bPOSIXRlimit\x12\x12\n\x04Type\x18\x01\x20\x01(\tR\x04Type\ + \x12\x12\n\x04Hard\x18\x02\x20\x01(\x04R\x04Hard\x12\x12\n\x04Soft\x18\ + \x03\x20\x01(\x04R\x04Soft\"o\n\x05Mount\x12\x20\n\x0bdestination\x18\ + \x01\x20\x01(\tR\x0bdestination\x12\x16\n\x06source\x18\x02\x20\x01(\tR\ + \x06source\x12\x12\n\x04type\x18\x03\x20\x01(\tR\x04type\x12\x18\n\x07op\ + tions\x18\x04\x20\x03(\tR\x07options\"6\n\x04Root\x12\x12\n\x04Path\x18\ + \x01\x20\x01(\tR\x04Path\x12\x1a\n\x08Readonly\x18\x02\x20\x01(\x08R\x08\ + Readonly\"\x93\x01\n\x05Hooks\x12,\n\x08Prestart\x18\x01\x20\x03(\x0b2\n\ + .grpc.HookR\x08PrestartB\x04\xc8\xde\x1f\0\x12.\n\tPoststart\x18\x02\x20\ + \x03(\x0b2\n.grpc.HookR\tPoststartB\x04\xc8\xde\x1f\0\x12,\n\x08Poststop\ + \x18\x03\x20\x03(\x0b2\n.grpc.HookR\x08PoststopB\x04\xc8\xde\x1f\0\"Z\n\ + \x04Hook\x12\x12\n\x04Path\x18\x01\x20\x01(\tR\x04Path\x12\x12\n\x04Args\ + \x18\x02\x20\x03(\tR\x04Args\x12\x10\n\x03Env\x18\x03\x20\x03(\tR\x03Env\ + \x12\x18\n\x07Timeout\x18\x04\x20\x01(\x03R\x07Timeout\"\xa9\x05\n\x05Li\ + nux\x12<\n\x0bUIDMappings\x18\x01\x20\x03(\x0b2\x14.grpc.LinuxIDMappingR\ + \x0bUIDMappingsB\x04\xc8\xde\x1f\0\x12<\n\x0bGIDMappings\x18\x02\x20\x03\ + (\x0b2\x14.grpc.LinuxIDMappingR\x0bGIDMappingsB\x04\xc8\xde\x1f\0\x12/\n\ + \x06Sysctl\x18\x03\x20\x03(\x0b2\x17.grpc.Linux.SysctlEntryR\x06Sysctl\ + \x122\n\tResources\x18\x04\x20\x01(\x0b2\x14.grpc.LinuxResourcesR\tResou\ + rces\x12\x20\n\x0bCgroupsPath\x18\x05\x20\x01(\tR\x0bCgroupsPath\x12:\n\ + \nNamespaces\x18\x06\x20\x03(\x0b2\x14.grpc.LinuxNamespaceR\nNamespacesB\ + \x04\xc8\xde\x1f\0\x121\n\x07Devices\x18\x07\x20\x03(\x0b2\x11.grpc.Linu\ + xDeviceR\x07DevicesB\x04\xc8\xde\x1f\0\x12,\n\x07Seccomp\x18\x08\x20\x01\ + (\x0b2\x12.grpc.LinuxSeccompR\x07Seccomp\x12,\n\x11RootfsPropagation\x18\ + \t\x20\x01(\tR\x11RootfsPropagation\x12\x20\n\x0bMaskedPaths\x18\n\x20\ + \x03(\tR\x0bMaskedPaths\x12$\n\rReadonlyPaths\x18\x0b\x20\x03(\tR\rReado\ + nlyPaths\x12\x1e\n\nMountLabel\x18\x0c\x20\x01(\tR\nMountLabel\x12/\n\ + \x08IntelRdt\x18\r\x20\x01(\x0b2\x13.grpc.LinuxIntelRdtR\x08IntelRdt\x1a\ + 9\n\x0bSysctlEntry\x12\x10\n\x03key\x18\x01\x20\x01(\tR\x03key\x12\x14\n\ + \x05value\x18\x02\x20\x01(\tR\x05value:\x028\x01\"\x1f\n\x07Windows\x12\ + \x14\n\x05dummy\x18\x01\x20\x01(\tR\x05dummy\"\x1f\n\x07Solaris\x12\x14\ + \n\x05dummy\x18\x01\x20\x01(\tR\x05dummy\"^\n\x0eLinuxIDMapping\x12\x16\ + \n\x06HostID\x18\x01\x20\x01(\rR\x06HostID\x12\x20\n\x0bContainerID\x18\ + \x02\x20\x01(\rR\x0bContainerID\x12\x12\n\x04Size\x18\x03\x20\x01(\rR\ + \x04Size\"8\n\x0eLinuxNamespace\x12\x12\n\x04Type\x18\x01\x20\x01(\tR\ + \x04Type\x12\x12\n\x04Path\x18\x02\x20\x01(\tR\x04Path\"\xa1\x01\n\x0bLi\ + nuxDevice\x12\x12\n\x04Path\x18\x01\x20\x01(\tR\x04Path\x12\x12\n\x04Typ\ + e\x18\x02\x20\x01(\tR\x04Type\x12\x14\n\x05Major\x18\x03\x20\x01(\x03R\ + \x05Major\x12\x14\n\x05Minor\x18\x04\x20\x01(\x03R\x05Minor\x12\x1a\n\ + \x08FileMode\x18\x05\x20\x01(\rR\x08FileMode\x12\x10\n\x03UID\x18\x06\ + \x20\x01(\rR\x03UID\x12\x10\n\x03GID\x18\x07\x20\x01(\rR\x03GID\"\xdf\ + \x02\n\x0eLinuxResources\x127\n\x07Devices\x18\x01\x20\x03(\x0b2\x17.grp\ + c.LinuxDeviceCgroupR\x07DevicesB\x04\xc8\xde\x1f\0\x12)\n\x06Memory\x18\ + \x02\x20\x01(\x0b2\x11.grpc.LinuxMemoryR\x06Memory\x12\x20\n\x03CPU\x18\ + \x03\x20\x01(\x0b2\x0e.grpc.LinuxCPUR\x03CPU\x12#\n\x04Pids\x18\x04\x20\ + \x01(\x0b2\x0f.grpc.LinuxPidsR\x04Pids\x12,\n\x07BlockIO\x18\x05\x20\x01\ + (\x0b2\x12.grpc.LinuxBlockIOR\x07BlockIO\x12F\n\x0eHugepageLimits\x18\ + \x06\x20\x03(\x0b2\x18.grpc.LinuxHugepageLimitR\x0eHugepageLimitsB\x04\ + \xc8\xde\x1f\0\x12,\n\x07Network\x18\x07\x20\x01(\x0b2\x12.grpc.LinuxNet\ + workR\x07Network\"\xdb\x01\n\x0bLinuxMemory\x12\x14\n\x05Limit\x18\x01\ + \x20\x01(\x03R\x05Limit\x12\x20\n\x0bReservation\x18\x02\x20\x01(\x03R\ + \x0bReservation\x12\x12\n\x04Swap\x18\x03\x20\x01(\x03R\x04Swap\x12\x16\ + \n\x06Kernel\x18\x04\x20\x01(\x03R\x06Kernel\x12\x1c\n\tKernelTCP\x18\ + \x05\x20\x01(\x03R\tKernelTCP\x12\x1e\n\nSwappiness\x18\x06\x20\x01(\x04\ + R\nSwappiness\x12*\n\x10DisableOOMKiller\x18\x07\x20\x01(\x08R\x10Disabl\ + eOOMKiller\"\xca\x01\n\x08LinuxCPU\x12\x16\n\x06Shares\x18\x01\x20\x01(\ + \x04R\x06Shares\x12\x14\n\x05Quota\x18\x02\x20\x01(\x03R\x05Quota\x12\ + \x16\n\x06Period\x18\x03\x20\x01(\x04R\x06Period\x12(\n\x0fRealtimeRunti\ + me\x18\x04\x20\x01(\x03R\x0fRealtimeRuntime\x12&\n\x0eRealtimePeriod\x18\ + \x05\x20\x01(\x04R\x0eRealtimePeriod\x12\x12\n\x04Cpus\x18\x06\x20\x01(\ + \tR\x04Cpus\x12\x12\n\x04Mems\x18\x07\x20\x01(\tR\x04Mems\"w\n\x11LinuxW\ + eightDevice\x12\x14\n\x05Major\x18\x01\x20\x01(\x03R\x05Major\x12\x14\n\ + \x05Minor\x18\x02\x20\x01(\x03R\x05Minor\x12\x16\n\x06Weight\x18\x03\x20\ + \x01(\rR\x06Weight\x12\x1e\n\nLeafWeight\x18\x04\x20\x01(\rR\nLeafWeight\ + \"U\n\x13LinuxThrottleDevice\x12\x14\n\x05Major\x18\x01\x20\x01(\x03R\ + \x05Major\x12\x14\n\x05Minor\x18\x02\x20\x01(\x03R\x05Minor\x12\x12\n\ + \x04Rate\x18\x03\x20\x01(\x04R\x04Rate\"\xed\x03\n\x0cLinuxBlockIO\x12\ + \x16\n\x06Weight\x18\x01\x20\x01(\rR\x06Weight\x12\x1e\n\nLeafWeight\x18\ + \x02\x20\x01(\rR\nLeafWeight\x12A\n\x0cWeightDevice\x18\x03\x20\x03(\x0b\ + 2\x17.grpc.LinuxWeightDeviceR\x0cWeightDeviceB\x04\xc8\xde\x1f\0\x12U\n\ + \x15ThrottleReadBpsDevice\x18\x04\x20\x03(\x0b2\x19.grpc.LinuxThrottleDe\ + viceR\x15ThrottleReadBpsDeviceB\x04\xc8\xde\x1f\0\x12W\n\x16ThrottleWrit\ + eBpsDevice\x18\x05\x20\x03(\x0b2\x19.grpc.LinuxThrottleDeviceR\x16Thrott\ + leWriteBpsDeviceB\x04\xc8\xde\x1f\0\x12W\n\x16ThrottleReadIOPSDevice\x18\ + \x06\x20\x03(\x0b2\x19.grpc.LinuxThrottleDeviceR\x16ThrottleReadIOPSDevi\ + ceB\x04\xc8\xde\x1f\0\x12Y\n\x17ThrottleWriteIOPSDevice\x18\x07\x20\x03(\ + \x0b2\x19.grpc.LinuxThrottleDeviceR\x17ThrottleWriteIOPSDeviceB\x04\xc8\ + \xde\x1f\0\"!\n\tLinuxPids\x12\x14\n\x05Limit\x18\x01\x20\x01(\x03R\x05L\ + imit\"\x81\x01\n\x11LinuxDeviceCgroup\x12\x14\n\x05Allow\x18\x01\x20\x01\ + (\x08R\x05Allow\x12\x12\n\x04Type\x18\x02\x20\x01(\tR\x04Type\x12\x14\n\ + \x05Major\x18\x03\x20\x01(\x03R\x05Major\x12\x14\n\x05Minor\x18\x04\x20\ + \x01(\x03R\x05Minor\x12\x16\n\x06Access\x18\x05\x20\x01(\tR\x06Access\"l\ + \n\x0cLinuxNetwork\x12\x18\n\x07ClassID\x18\x01\x20\x01(\rR\x07ClassID\ + \x12B\n\nPriorities\x18\x02\x20\x03(\x0b2\x1c.grpc.LinuxInterfacePriorit\ + yR\nPrioritiesB\x04\xc8\xde\x1f\0\"F\n\x12LinuxHugepageLimit\x12\x1a\n\ + \x08Pagesize\x18\x01\x20\x01(\tR\x08Pagesize\x12\x14\n\x05Limit\x18\x02\ + \x20\x01(\x04R\x05Limit\"H\n\x16LinuxInterfacePriority\x12\x12\n\x04Name\ + \x18\x01\x20\x01(\tR\x04Name\x12\x1a\n\x08Priority\x18\x02\x20\x01(\rR\ + \x08Priority\"\x90\x01\n\x0cLinuxSeccomp\x12$\n\rDefaultAction\x18\x01\ + \x20\x01(\tR\rDefaultAction\x12$\n\rArchitectures\x18\x02\x20\x03(\tR\rA\ + rchitectures\x124\n\x08Syscalls\x18\x03\x20\x03(\x0b2\x12.grpc.LinuxSysc\ + allR\x08SyscallsB\x04\xc8\xde\x1f\0\"i\n\x0fLinuxSeccompArg\x12\x14\n\ + \x05Index\x18\x01\x20\x01(\x04R\x05Index\x12\x14\n\x05Value\x18\x02\x20\ + \x01(\x04R\x05Value\x12\x1a\n\x08ValueTwo\x18\x03\x20\x01(\x04R\x08Value\ + Two\x12\x0e\n\x02Op\x18\x04\x20\x01(\tR\x02Op\"m\n\x0cLinuxSyscall\x12\ + \x14\n\x05Names\x18\x01\x20\x03(\tR\x05Names\x12\x16\n\x06Action\x18\x02\ + \x20\x01(\tR\x06Action\x12/\n\x04Args\x18\x03\x20\x03(\x0b2\x15.grpc.Lin\ + uxSeccompArgR\x04ArgsB\x04\xc8\xde\x1f\0\"5\n\rLinuxIntelRdt\x12$\n\rL3C\ + acheSchema\x18\x01\x20\x01(\tR\rL3CacheSchemaB\x10\xf8\xe1\x1e\x01\xa8\ + \xe2\x1e\x01\xb8\xe2\x1e\x01\xc0\xe2\x1e\x01J\xc3\x93\x01\n\x07\x12\x05\ + \x06\0\xcd\x03\x01\nX\n\x01\x0c\x12\x03\x06\0\x122N\n\x20Copyright\x20(c\ + )\x202017\x20Intel\x20Corporation\n\n\x20SPDX-License-Identifier:\x20Apa\ + che-2.0\n\n\n\x08\n\x01\x02\x12\x03\x08\0\r\n\t\n\x02\x03\0\x12\x03\n\07\ + \n\t\n\x02\x03\x01\x12\x03\x0b\0(\n\x08\n\x01\x08\x12\x03\r\0$\n\x0b\n\ + \x04\x08\xa5\xec\x03\x12\x03\r\0$\n\x08\n\x01\x08\x12\x03\x0e\0'\n\x0b\n\ + \x04\x08\x9f\xec\x03\x12\x03\x0e\0'\n\x08\n\x01\x08\x12\x03\x0f\0&\n\x0b\ + \n\x04\x08\xa7\xec\x03\x12\x03\x0f\0&\n\x08\n\x01\x08\x12\x03\x10\0'\n\ + \x0b\n\x04\x08\xa8\xec\x03\x12\x03\x10\0'\n\n\n\x02\x04\0\x12\x04\x12\0/\ + \x01\n\n\n\x03\x04\0\x01\x12\x03\x12\x08\x0c\nm\n\x04\x04\0\x02\0\x12\ + \x03\x14\x08\x1b\x1a`\x20Version\x20of\x20the\x20Open\x20Container\x20In\ + itiative\x20Runtime\x20Specification\x20with\x20which\x20the\x20bundle\ + \x20complies.\n\n\r\n\x05\x04\0\x02\0\x04\x12\x04\x14\x08\x12\x0e\n\x0c\ + \n\x05\x04\0\x02\0\x05\x12\x03\x14\x08\x0e\n\x0c\n\x05\x04\0\x02\0\x01\ + \x12\x03\x14\x0f\x16\n\x0c\n\x05\x04\0\x02\0\x03\x12\x03\x14\x19\x1a\n8\ + \n\x04\x04\0\x02\x01\x12\x03\x17\x08\x1c\x1a+\x20Process\x20configures\ + \x20the\x20container\x20process.\n\n\r\n\x05\x04\0\x02\x01\x04\x12\x04\ + \x17\x08\x14\x1b\n\x0c\n\x05\x04\0\x02\x01\x06\x12\x03\x17\x08\x0f\n\x0c\ + \n\x05\x04\0\x02\x01\x01\x12\x03\x17\x10\x17\n\x0c\n\x05\x04\0\x02\x01\ + \x03\x12\x03\x17\x1a\x1b\n?\n\x04\x04\0\x02\x02\x12\x03\x1a\x08\x16\x1a2\ + \x20Root\x20configures\x20the\x20container's\x20root\x20filesystem.\n\n\ + \r\n\x05\x04\0\x02\x02\x04\x12\x04\x1a\x08\x17\x1c\n\x0c\n\x05\x04\0\x02\ + \x02\x06\x12\x03\x1a\x08\x0c\n\x0c\n\x05\x04\0\x02\x02\x01\x12\x03\x1a\r\ + \x11\n\x0c\n\x05\x04\0\x02\x02\x03\x12\x03\x1a\x14\x15\n<\n\x04\x04\0\ + \x02\x03\x12\x03\x1d\x08\x1c\x1a/\x20Hostname\x20configures\x20the\x20co\ + ntainer's\x20hostname.\n\n\r\n\x05\x04\0\x02\x03\x04\x12\x04\x1d\x08\x1a\ + \x16\n\x0c\n\x05\x04\0\x02\x03\x05\x12\x03\x1d\x08\x0e\n\x0c\n\x05\x04\0\ + \x02\x03\x01\x12\x03\x1d\x0f\x17\n\x0c\n\x05\x04\0\x02\x03\x03\x12\x03\ + \x1d\x1a\x1b\nD\n\x04\x04\0\x02\x04\x12\x03\x20\x08A\x1a7\x20Mounts\x20c\ + onfigures\x20additional\x20mounts\x20(on\x20top\x20of\x20Root).\n\n\x0c\ + \n\x05\x04\0\x02\x04\x04\x12\x03\x20\x08\x10\n\x0c\n\x05\x04\0\x02\x04\ + \x06\x12\x03\x20\x11\x16\n\x0c\n\x05\x04\0\x02\x04\x01\x12\x03\x20\x17\ + \x1d\n\x0c\n\x05\x04\0\x02\x04\x03\x12\x03\x20\x20!\n\x0c\n\x05\x04\0\ + \x02\x04\x08\x12\x03\x20\"@\n\x0f\n\x08\x04\0\x02\x04\x08\xe9\xfb\x03\ + \x12\x03\x20#?\nI\n\x04\x04\0\x02\x05\x12\x03#\x08\x18\x1a<\x20Hooks\x20\ + configures\x20callbacks\x20for\x20container\x20lifecycle\x20events.\n\n\ + \r\n\x05\x04\0\x02\x05\x04\x12\x04#\x08\x20A\n\x0c\n\x05\x04\0\x02\x05\ + \x06\x12\x03#\x08\r\n\x0c\n\x05\x04\0\x02\x05\x01\x12\x03#\x0e\x13\n\x0c\ + \n\x05\x04\0\x02\x05\x03\x12\x03#\x16\x17\nI\n\x04\x04\0\x02\x06\x12\x03\ + &\x08,\x1a<\x20Annotations\x20contains\x20arbitrary\x20metadata\x20for\ + \x20the\x20container.\n\n\r\n\x05\x04\0\x02\x06\x04\x12\x04&\x08#\x18\n\ + \x0c\n\x05\x04\0\x02\x06\x06\x12\x03&\x08\x1b\n\x0c\n\x05\x04\0\x02\x06\ + \x01\x12\x03&\x1c'\n\x0c\n\x05\x04\0\x02\x06\x03\x12\x03&*+\nS\n\x04\x04\ + \0\x02\x07\x12\x03)\x08\x18\x1aF\x20Linux\x20is\x20platform-specific\x20\ + configuration\x20for\x20Linux\x20based\x20containers.\n\n\r\n\x05\x04\0\ + \x02\x07\x04\x12\x04)\x08&,\n\x0c\n\x05\x04\0\x02\x07\x06\x12\x03)\x08\r\ + \n\x0c\n\x05\x04\0\x02\x07\x01\x12\x03)\x0e\x13\n\x0c\n\x05\x04\0\x02\ + \x07\x03\x12\x03)\x16\x17\nW\n\x04\x04\0\x02\x08\x12\x03,\x08\x1c\x1aJ\ + \x20Solaris\x20is\x20platform-specific\x20configuration\x20for\x20Solari\ + s\x20based\x20containers.\n\n\r\n\x05\x04\0\x02\x08\x04\x12\x04,\x08)\ + \x18\n\x0c\n\x05\x04\0\x02\x08\x06\x12\x03,\x08\x0f\n\x0c\n\x05\x04\0\ + \x02\x08\x01\x12\x03,\x10\x17\n\x0c\n\x05\x04\0\x02\x08\x03\x12\x03,\x1a\ + \x1b\nW\n\x04\x04\0\x02\t\x12\x03.\x08\x1d\x1aJ\x20Windows\x20is\x20plat\ + form-specific\x20configuration\x20for\x20Windows\x20based\x20containers.\ + \n\n\r\n\x05\x04\0\x02\t\x04\x12\x04.\x08,\x1c\n\x0c\n\x05\x04\0\x02\t\ + \x06\x12\x03.\x08\x0f\n\x0c\n\x05\x04\0\x02\t\x01\x12\x03.\x10\x17\n\x0c\ + \n\x05\x04\0\x02\t\x03\x12\x03.\x1a\x1c\n\n\n\x02\x04\x01\x12\x041\0V\ + \x01\n\n\n\x03\x04\x01\x01\x12\x031\x08\x0f\nJ\n\x04\x04\x01\x02\0\x12\ + \x033\x08\x1a\x1a=\x20Terminal\x20creates\x20an\x20interactive\x20termin\ + al\x20for\x20the\x20container.\n\n\r\n\x05\x04\x01\x02\0\x04\x12\x043\ + \x081\x11\n\x0c\n\x05\x04\x01\x02\0\x05\x12\x033\x08\x0c\n\x0c\n\x05\x04\ + \x01\x02\0\x01\x12\x033\r\x15\n\x0c\n\x05\x04\x01\x02\0\x03\x12\x033\x18\ + \x19\n=\n\x04\x04\x01\x02\x01\x12\x036\x08\x1c\x1a0\x20ConsoleSize\x20sp\ + ecifies\x20the\x20size\x20of\x20the\x20console.\n\n\r\n\x05\x04\x01\x02\ + \x01\x04\x12\x046\x083\x1a\n\x0c\n\x05\x04\x01\x02\x01\x06\x12\x036\x08\ + \x0b\n\x0c\n\x05\x04\x01\x02\x01\x01\x12\x036\x0c\x17\n\x0c\n\x05\x04\ + \x01\x02\x01\x03\x12\x036\x1a\x1b\n?\n\x04\x04\x01\x02\x02\x12\x039\x085\ + \x1a2\x20User\x20specifies\x20user\x20information\x20for\x20the\x20proce\ + ss.\n\n\r\n\x05\x04\x01\x02\x02\x04\x12\x049\x086\x1c\n\x0c\n\x05\x04\ + \x01\x02\x02\x06\x12\x039\x08\x0c\n\x0c\n\x05\x04\x01\x02\x02\x01\x12\ + \x039\r\x11\n\x0c\n\x05\x04\x01\x02\x02\x03\x12\x039\x14\x15\n\x0c\n\x05\ + \x04\x01\x02\x02\x08\x12\x039\x164\n\x0f\n\x08\x04\x01\x02\x02\x08\xe9\ + \xfb\x03\x12\x039\x173\nV\n\x04\x04\x01\x02\x03\x12\x03<\x08!\x1aI\x20Ar\ + gs\x20specifies\x20the\x20binary\x20and\x20arguments\x20for\x20the\x20ap\ + plication\x20to\x20execute.\n\n\x0c\n\x05\x04\x01\x02\x03\x04\x12\x03<\ + \x08\x10\n\x0c\n\x05\x04\x01\x02\x03\x05\x12\x03<\x11\x17\n\x0c\n\x05\ + \x04\x01\x02\x03\x01\x12\x03<\x18\x1c\n\x0c\n\x05\x04\x01\x02\x03\x03\ + \x12\x03<\x1f\x20\nE\n\x04\x04\x01\x02\x04\x12\x03?\x08\x20\x1a8\x20Env\ + \x20populates\x20the\x20process\x20environment\x20for\x20the\x20process.\ + \n\n\x0c\n\x05\x04\x01\x02\x04\x04\x12\x03?\x08\x10\n\x0c\n\x05\x04\x01\ + \x02\x04\x05\x12\x03?\x11\x17\n\x0c\n\x05\x04\x01\x02\x04\x01\x12\x03?\ + \x18\x1b\n\x0c\n\x05\x04\x01\x02\x04\x03\x12\x03?\x1e\x1f\nr\n\x04\x04\ + \x01\x02\x05\x12\x03C\x08\x17\x1ae\x20Cwd\x20is\x20the\x20current\x20wor\ + king\x20directory\x20for\x20the\x20process\x20and\x20must\x20be\n\x20rel\ + ative\x20to\x20the\x20container's\x20root.\n\n\r\n\x05\x04\x01\x02\x05\ + \x04\x12\x04C\x08?\x20\n\x0c\n\x05\x04\x01\x02\x05\x05\x12\x03C\x08\x0e\ + \n\x0c\n\x05\x04\x01\x02\x05\x01\x12\x03C\x0f\x12\n\x0c\n\x05\x04\x01\ + \x02\x05\x03\x12\x03C\x15\x16\nQ\n\x04\x04\x01\x02\x06\x12\x03F\x08+\x1a\ + D\x20Capabilities\x20are\x20Linux\x20capabilities\x20that\x20are\x20kept\ + \x20for\x20the\x20process.\n\n\r\n\x05\x04\x01\x02\x06\x04\x12\x04F\x08C\ + \x17\n\x0c\n\x05\x04\x01\x02\x06\x06\x12\x03F\x08\x19\n\x0c\n\x05\x04\ + \x01\x02\x06\x01\x12\x03F\x1a&\n\x0c\n\x05\x04\x01\x02\x06\x03\x12\x03F)\ + *\nH\n\x04\x04\x01\x02\x07\x12\x03I\x08H\x1a;\x20Rlimits\x20specifies\ + \x20rlimit\x20options\x20to\x20apply\x20to\x20the\x20process.\n\n\x0c\n\ + \x05\x04\x01\x02\x07\x04\x12\x03I\x08\x10\n\x0c\n\x05\x04\x01\x02\x07\ + \x06\x12\x03I\x11\x1c\n\x0c\n\x05\x04\x01\x02\x07\x01\x12\x03I\x1d$\n\ + \x0c\n\x05\x04\x01\x02\x07\x03\x12\x03I'(\n\x0c\n\x05\x04\x01\x02\x07\ + \x08\x12\x03I)G\n\x0f\n\x08\x04\x01\x02\x07\x08\xe9\xfb\x03\x12\x03I*F\n\ + u\n\x04\x04\x01\x02\x08\x12\x03L\x08!\x1ah\x20NoNewPrivileges\x20control\ + s\x20whether\x20additional\x20privileges\x20could\x20be\x20gained\x20by\ + \x20processes\x20in\x20the\x20container.\t\n\n\r\n\x05\x04\x01\x02\x08\ + \x04\x12\x04L\x08IH\n\x0c\n\x05\x04\x01\x02\x08\x05\x12\x03L\x08\x0c\n\ + \x0c\n\x05\x04\x01\x02\x08\x01\x12\x03L\r\x1c\n\x0c\n\x05\x04\x01\x02\ + \x08\x03\x12\x03L\x1f\x20\nP\n\x04\x04\x01\x02\t\x12\x03O\x08$\x1aC\x20A\ + pparmorProfile\x20specifies\x20the\x20apparmor\x20profile\x20for\x20the\ + \x20container.\n\n\r\n\x05\x04\x01\x02\t\x04\x12\x04O\x08L!\n\x0c\n\x05\ + \x04\x01\x02\t\x05\x12\x03O\x08\x0e\n\x0c\n\x05\x04\x01\x02\t\x01\x12\ + \x03O\x0f\x1e\n\x0c\n\x05\x04\x01\x02\t\x03\x12\x03O!#\n:\n\x04\x04\x01\ + \x02\n\x12\x03R\x08\x1f\x1a-\x20Specify\x20an\x20oom_score_adj\x20for\ + \x20the\x20container.\n\n\r\n\x05\x04\x01\x02\n\x04\x12\x04R\x08O$\n\x0c\ + \n\x05\x04\x01\x02\n\x05\x12\x03R\x08\r\n\x0c\n\x05\x04\x01\x02\n\x01\ + \x12\x03R\x0e\x19\n\x0c\n\x05\x04\x01\x02\n\x03\x12\x03R\x1c\x1e\n_\n\ + \x04\x04\x01\x02\x0b\x12\x03U\x08!\x1aR\x20SelinuxLabel\x20specifies\x20\ + the\x20selinux\x20context\x20that\x20the\x20container\x20process\x20is\ + \x20run\x20as.\n\n\r\n\x05\x04\x01\x02\x0b\x04\x12\x04U\x08R\x1f\n\x0c\n\ + \x05\x04\x01\x02\x0b\x05\x12\x03U\x08\x0e\n\x0c\n\x05\x04\x01\x02\x0b\ + \x01\x12\x03U\x0f\x1b\n\x0c\n\x05\x04\x01\x02\x0b\x03\x12\x03U\x1e\x20\n\ + \n\n\x02\x04\x02\x12\x04X\0^\x01\n\n\n\x03\x04\x02\x01\x12\x03X\x08\x0b\ + \n9\n\x04\x04\x02\x02\0\x12\x03Z\x08\x1a\x1a,\x20Height\x20is\x20the\x20\ + vertical\x20dimension\x20of\x20a\x20box.\n\n\r\n\x05\x04\x02\x02\0\x04\ + \x12\x04Z\x08X\r\n\x0c\n\x05\x04\x02\x02\0\x05\x12\x03Z\x08\x0e\n\x0c\n\ + \x05\x04\x02\x02\0\x01\x12\x03Z\x0f\x15\n\x0c\n\x05\x04\x02\x02\0\x03\ + \x12\x03Z\x18\x19\n;\n\x04\x04\x02\x02\x01\x12\x03]\x08\x19\x1a.\x20Widt\ + h\x20is\x20the\x20horizontal\x20dimension\x20of\x20a\x20box.\t\n\n\r\n\ + \x05\x04\x02\x02\x01\x04\x12\x04]\x08Z\x1a\n\x0c\n\x05\x04\x02\x02\x01\ + \x05\x12\x03]\x08\x0e\n\x0c\n\x05\x04\x02\x02\x01\x01\x12\x03]\x0f\x14\n\ + \x0c\n\x05\x04\x02\x02\x01\x03\x12\x03]\x17\x18\n\n\n\x02\x04\x03\x12\ + \x04`\0l\x01\n\n\n\x03\x04\x03\x01\x12\x03`\x08\x0c\n\"\n\x04\x04\x03\ + \x02\0\x12\x03b\x08\x17\x1a\x15\x20UID\x20is\x20the\x20user\x20id.\n\n\r\ + \n\x05\x04\x03\x02\0\x04\x12\x04b\x08`\x0e\n\x0c\n\x05\x04\x03\x02\0\x05\ + \x12\x03b\x08\x0e\n\x0c\n\x05\x04\x03\x02\0\x01\x12\x03b\x0f\x12\n\x0c\n\ + \x05\x04\x03\x02\0\x03\x12\x03b\x15\x16\n#\n\x04\x04\x03\x02\x01\x12\x03\ + e\x08\x17\x1a\x16\x20GID\x20is\x20the\x20group\x20id.\n\n\r\n\x05\x04\ + \x03\x02\x01\x04\x12\x04e\x08b\x17\n\x0c\n\x05\x04\x03\x02\x01\x05\x12\ + \x03e\x08\x0e\n\x0c\n\x05\x04\x03\x02\x01\x01\x12\x03e\x0f\x12\n\x0c\n\ + \x05\x04\x03\x02\x01\x03\x12\x03e\x15\x16\nW\n\x04\x04\x03\x02\x02\x12\ + \x03h\x08+\x1aJ\x20AdditionalGids\x20are\x20additional\x20group\x20ids\ + \x20set\x20for\x20the\x20container's\x20process.\n\n\x0c\n\x05\x04\x03\ + \x02\x02\x04\x12\x03h\x08\x10\n\x0c\n\x05\x04\x03\x02\x02\x05\x12\x03h\ + \x11\x17\n\x0c\n\x05\x04\x03\x02\x02\x01\x12\x03h\x18&\n\x0c\n\x05\x04\ + \x03\x02\x02\x03\x12\x03h)*\n)\n\x04\x04\x03\x02\x03\x12\x03k\x08\x1c\ + \x1a\x1c\x20Username\x20is\x20the\x20user\x20name.\n\n\r\n\x05\x04\x03\ + \x02\x03\x04\x12\x04k\x08h+\n\x0c\n\x05\x04\x03\x02\x03\x05\x12\x03k\x08\ + \x0e\n\x0c\n\x05\x04\x03\x02\x03\x01\x12\x03k\x0f\x17\n\x0c\n\x05\x04\ + \x03\x02\x03\x03\x12\x03k\x1a\x1b\n\n\n\x02\x04\x04\x12\x04n\0}\x01\n\n\ + \n\x03\x04\x04\x01\x12\x03n\x08\x19\nI\n\x04\x04\x04\x02\0\x12\x03p\x08%\ + \x1a<\x20Bounding\x20is\x20the\x20set\x20of\x20capabilities\x20checked\ + \x20by\x20the\x20kernel.\n\n\x0c\n\x05\x04\x04\x02\0\x04\x12\x03p\x08\ + \x10\n\x0c\n\x05\x04\x04\x02\0\x05\x12\x03p\x11\x17\n\x0c\n\x05\x04\x04\ + \x02\0\x01\x12\x03p\x18\x20\n\x0c\n\x05\x04\x04\x02\0\x03\x12\x03p#$\nJ\ + \n\x04\x04\x04\x02\x01\x12\x03s\x08&\x1a=\x20Effective\x20is\x20the\x20s\ + et\x20of\x20capabilities\x20checked\x20by\x20the\x20kernel.\n\n\x0c\n\ + \x05\x04\x04\x02\x01\x04\x12\x03s\x08\x10\n\x0c\n\x05\x04\x04\x02\x01\ + \x05\x12\x03s\x11\x17\n\x0c\n\x05\x04\x04\x02\x01\x01\x12\x03s\x18!\n\ + \x0c\n\x05\x04\x04\x02\x01\x03\x12\x03s$%\nG\n\x04\x04\x04\x02\x02\x12\ + \x03v\x08(\x1a:\x20Inheritable\x20is\x20the\x20capabilities\x20preserved\ + \x20across\x20execve.\n\n\x0c\n\x05\x04\x04\x02\x02\x04\x12\x03v\x08\x10\ + \n\x0c\n\x05\x04\x04\x02\x02\x05\x12\x03v\x11\x17\n\x0c\n\x05\x04\x04\ + \x02\x02\x01\x12\x03v\x18#\n\x0c\n\x05\x04\x04\x02\x02\x03\x12\x03v&'\nM\ + \n\x04\x04\x04\x02\x03\x12\x03y\x08&\x1a@\x20Permitted\x20is\x20the\x20l\ + imiting\x20superset\x20for\x20effective\x20capabilities.\n\n\x0c\n\x05\ + \x04\x04\x02\x03\x04\x12\x03y\x08\x10\n\x0c\n\x05\x04\x04\x02\x03\x05\ + \x12\x03y\x11\x17\n\x0c\n\x05\x04\x04\x02\x03\x01\x12\x03y\x18!\n\x0c\n\ + \x05\x04\x04\x02\x03\x03\x12\x03y$%\nH\n\x04\x04\x04\x02\x04\x12\x03|\ + \x08$\x1a;\x20Ambient\x20is\x20the\x20ambient\x20set\x20of\x20capabiliti\ + es\x20that\x20are\x20kept.\n\n\x0c\n\x05\x04\x04\x02\x04\x04\x12\x03|\ + \x08\x10\n\x0c\n\x05\x04\x04\x02\x04\x05\x12\x03|\x11\x17\n\x0c\n\x05\ + \x04\x04\x02\x04\x01\x12\x03|\x18\x1f\n\x0c\n\x05\x04\x04\x02\x04\x03\ + \x12\x03|\"#\n\x0b\n\x02\x04\x05\x12\x05\x7f\0\x88\x01\x01\n\n\n\x03\x04\ + \x05\x01\x12\x03\x7f\x08\x13\n)\n\x04\x04\x05\x02\0\x12\x04\x81\x01\x08\ + \x18\x1a\x1b\x20Type\x20of\x20the\x20rlimit\x20to\x20set\n\n\x0e\n\x05\ + \x04\x05\x02\0\x04\x12\x05\x81\x01\x08\x7f\x15\n\r\n\x05\x04\x05\x02\0\ + \x05\x12\x04\x81\x01\x08\x0e\n\r\n\x05\x04\x05\x02\0\x01\x12\x04\x81\x01\ + \x0f\x13\n\r\n\x05\x04\x05\x02\0\x03\x12\x04\x81\x01\x16\x17\n=\n\x04\ + \x04\x05\x02\x01\x12\x04\x84\x01\x08\x18\x1a/\x20Hard\x20is\x20the\x20ha\ + rd\x20limit\x20for\x20the\x20specified\x20type\n\n\x0f\n\x05\x04\x05\x02\ + \x01\x04\x12\x06\x84\x01\x08\x81\x01\x18\n\r\n\x05\x04\x05\x02\x01\x05\ + \x12\x04\x84\x01\x08\x0e\n\r\n\x05\x04\x05\x02\x01\x01\x12\x04\x84\x01\ + \x0f\x13\n\r\n\x05\x04\x05\x02\x01\x03\x12\x04\x84\x01\x16\x17\n=\n\x04\ + \x04\x05\x02\x02\x12\x04\x87\x01\x08\x18\x1a/\x20Soft\x20is\x20the\x20so\ + ft\x20limit\x20for\x20the\x20specified\x20type\n\n\x0f\n\x05\x04\x05\x02\ + \x02\x04\x12\x06\x87\x01\x08\x84\x01\x18\n\r\n\x05\x04\x05\x02\x02\x05\ + \x12\x04\x87\x01\x08\x0e\n\r\n\x05\x04\x05\x02\x02\x01\x12\x04\x87\x01\ + \x0f\x13\n\r\n\x05\x04\x05\x02\x02\x03\x12\x04\x87\x01\x16\x17\n\x0c\n\ + \x02\x04\x06\x12\x06\x8a\x01\0\x95\x01\x01\n\x0b\n\x03\x04\x06\x01\x12\ + \x04\x8a\x01\x08\r\n_\n\x04\x04\x06\x02\0\x12\x04\x8c\x01\x08\x1f\x1aQ\ + \x20destination\x20is\x20the\x20path\x20inside\x20the\x20container\x20ex\ + pect\x20when\x20it\x20starts\x20with\x20\"tmp:/\"\n\n\x0f\n\x05\x04\x06\ + \x02\0\x04\x12\x06\x8c\x01\x08\x8a\x01\x0f\n\r\n\x05\x04\x06\x02\0\x05\ + \x12\x04\x8c\x01\x08\x0e\n\r\n\x05\x04\x06\x02\0\x01\x12\x04\x8c\x01\x0f\ + \x1a\n\r\n\x05\x04\x06\x02\0\x03\x12\x04\x8c\x01\x1d\x1e\n\xb4\x02\n\x04\ + \x04\x06\x02\x01\x12\x04\x92\x01\x08\x1a\x1a\xa5\x02\x20source\x20is\x20\ + the\x20path\x20inside\x20the\x20container\x20expect\x20when\x20it\x20sta\ + rts\x20with\x20\"vm:/dev/\"\x20or\x20\"tmp:/\"\n\x20the\x20path\x20which\ + \x20starts\x20with\x20\"vm:/dev/\"\x20refers\x20the\x20guest\x20vm's\x20\ + \"/dev\",\n\x20especially,\x20\"vm:/dev/hostfs/\"\x20refers\x20to\x20the\ + \x20shared\x20filesystem.\n\x20\"tmp:/\"\x20is\x20a\x20temporary\x20dire\ + ctory\x20which\x20is\x20used\x20for\x20temporary\x20mounts.\n\n\x0f\n\ + \x05\x04\x06\x02\x01\x04\x12\x06\x92\x01\x08\x8c\x01\x1f\n\r\n\x05\x04\ + \x06\x02\x01\x05\x12\x04\x92\x01\x08\x0e\n\r\n\x05\x04\x06\x02\x01\x01\ + \x12\x04\x92\x01\x0f\x15\n\r\n\x05\x04\x06\x02\x01\x03\x12\x04\x92\x01\ + \x18\x19\n\x0c\n\x04\x04\x06\x02\x02\x12\x04\x93\x01\x08\x18\n\x0f\n\x05\ + \x04\x06\x02\x02\x04\x12\x06\x93\x01\x08\x92\x01\x1a\n\r\n\x05\x04\x06\ + \x02\x02\x05\x12\x04\x93\x01\x08\x0e\n\r\n\x05\x04\x06\x02\x02\x01\x12\ + \x04\x93\x01\x0f\x13\n\r\n\x05\x04\x06\x02\x02\x03\x12\x04\x93\x01\x16\ + \x17\n\x0c\n\x04\x04\x06\x02\x03\x12\x04\x94\x01\x08$\n\r\n\x05\x04\x06\ + \x02\x03\x04\x12\x04\x94\x01\x08\x10\n\r\n\x05\x04\x06\x02\x03\x05\x12\ + \x04\x94\x01\x11\x17\n\r\n\x05\x04\x06\x02\x03\x01\x12\x04\x94\x01\x18\ + \x1f\n\r\n\x05\x04\x06\x02\x03\x03\x12\x04\x94\x01\"#\n\x0c\n\x02\x04\ + \x07\x12\x06\x97\x01\0\x9d\x01\x01\n\x0b\n\x03\x04\x07\x01\x12\x04\x97\ + \x01\x08\x0c\nM\n\x04\x04\x07\x02\0\x12\x04\x99\x01\x08\x18\x1a?\x20Path\ + \x20is\x20the\x20absolute\x20path\x20to\x20the\x20container's\x20root\ + \x20filesystem.\n\n\x0f\n\x05\x04\x07\x02\0\x04\x12\x06\x99\x01\x08\x97\ + \x01\x0e\n\r\n\x05\x04\x07\x02\0\x05\x12\x04\x99\x01\x08\x0e\n\r\n\x05\ + \x04\x07\x02\0\x01\x12\x04\x99\x01\x0f\x13\n\r\n\x05\x04\x07\x02\0\x03\ + \x12\x04\x99\x01\x16\x17\nm\n\x04\x04\x07\x02\x01\x12\x04\x9c\x01\x08\ + \x1a\x1a_\x20Readonly\x20makes\x20the\x20root\x20filesystem\x20for\x20th\ + e\x20container\x20readonly\x20before\x20the\x20process\x20is\x20executed\ + .\n\n\x0f\n\x05\x04\x07\x02\x01\x04\x12\x06\x9c\x01\x08\x99\x01\x18\n\r\ + \n\x05\x04\x07\x02\x01\x05\x12\x04\x9c\x01\x08\x0c\n\r\n\x05\x04\x07\x02\ + \x01\x01\x12\x04\x9c\x01\r\x15\n\r\n\x05\x04\x07\x02\x01\x03\x12\x04\x9c\ + \x01\x18\x19\n\x0c\n\x02\x04\x08\x12\x06\x9f\x01\0\xa8\x01\x01\n\x0b\n\ + \x03\x04\x08\x01\x12\x04\x9f\x01\x08\r\n_\n\x04\x04\x08\x02\0\x12\x04\ + \xa1\x01\x08C\x1aQ\x20Prestart\x20is\x20a\x20list\x20of\x20hooks\x20to\ + \x20be\x20run\x20before\x20the\x20container\x20process\x20is\x20executed\ + .\n\n\r\n\x05\x04\x08\x02\0\x04\x12\x04\xa1\x01\x08\x10\n\r\n\x05\x04\ + \x08\x02\0\x06\x12\x04\xa1\x01\x11\x15\n\r\n\x05\x04\x08\x02\0\x01\x12\ + \x04\xa1\x01\x16\x1e\n\r\n\x05\x04\x08\x02\0\x03\x12\x04\xa1\x01!\"\n\r\ + \n\x05\x04\x08\x02\0\x08\x12\x04\xa1\x01$B\n\x10\n\x08\x04\x08\x02\0\x08\ + \xe9\xfb\x03\x12\x04\xa1\x01%A\n^\n\x04\x04\x08\x02\x01\x12\x04\xa4\x01\ + \x08D\x1aP\x20Poststart\x20is\x20a\x20list\x20of\x20hooks\x20to\x20be\ + \x20run\x20after\x20the\x20container\x20process\x20is\x20started.\n\n\r\ + \n\x05\x04\x08\x02\x01\x04\x12\x04\xa4\x01\x08\x10\n\r\n\x05\x04\x08\x02\ + \x01\x06\x12\x04\xa4\x01\x11\x15\n\r\n\x05\x04\x08\x02\x01\x01\x12\x04\ + \xa4\x01\x16\x1f\n\r\n\x05\x04\x08\x02\x01\x03\x12\x04\xa4\x01\"#\n\r\n\ + \x05\x04\x08\x02\x01\x08\x12\x04\xa4\x01%C\n\x10\n\x08\x04\x08\x02\x01\ + \x08\xe9\xfb\x03\x12\x04\xa4\x01&B\nX\n\x04\x04\x08\x02\x02\x12\x04\xa7\ + \x01\x08C\x1aJ\x20Poststop\x20is\x20a\x20list\x20of\x20hooks\x20to\x20be\ + \x20run\x20after\x20the\x20container\x20process\x20exits.\n\n\r\n\x05\ + \x04\x08\x02\x02\x04\x12\x04\xa7\x01\x08\x10\n\r\n\x05\x04\x08\x02\x02\ + \x06\x12\x04\xa7\x01\x11\x15\n\r\n\x05\x04\x08\x02\x02\x01\x12\x04\xa7\ + \x01\x16\x1e\n\r\n\x05\x04\x08\x02\x02\x03\x12\x04\xa7\x01!\"\n\r\n\x05\ + \x04\x08\x02\x02\x08\x12\x04\xa7\x01$B\n\x10\n\x08\x04\x08\x02\x02\x08\ + \xe9\xfb\x03\x12\x04\xa7\x01%A\n\x0c\n\x02\x04\t\x12\x06\xaa\x01\0\xaf\ + \x01\x01\n\x0b\n\x03\x04\t\x01\x12\x04\xaa\x01\x08\x0c\n\x0c\n\x04\x04\t\ + \x02\0\x12\x04\xab\x01\x08\x18\n\x0f\n\x05\x04\t\x02\0\x04\x12\x06\xab\ + \x01\x08\xaa\x01\x0e\n\r\n\x05\x04\t\x02\0\x05\x12\x04\xab\x01\x08\x0e\n\ + \r\n\x05\x04\t\x02\0\x01\x12\x04\xab\x01\x0f\x13\n\r\n\x05\x04\t\x02\0\ + \x03\x12\x04\xab\x01\x16\x17\n\x0c\n\x04\x04\t\x02\x01\x12\x04\xac\x01\ + \x08!\n\r\n\x05\x04\t\x02\x01\x04\x12\x04\xac\x01\x08\x10\n\r\n\x05\x04\ + \t\x02\x01\x05\x12\x04\xac\x01\x11\x17\n\r\n\x05\x04\t\x02\x01\x01\x12\ + \x04\xac\x01\x18\x1c\n\r\n\x05\x04\t\x02\x01\x03\x12\x04\xac\x01\x1f\x20\ + \n\x0c\n\x04\x04\t\x02\x02\x12\x04\xad\x01\x08\x20\n\r\n\x05\x04\t\x02\ + \x02\x04\x12\x04\xad\x01\x08\x10\n\r\n\x05\x04\t\x02\x02\x05\x12\x04\xad\ + \x01\x11\x17\n\r\n\x05\x04\t\x02\x02\x01\x12\x04\xad\x01\x18\x1b\n\r\n\ + \x05\x04\t\x02\x02\x03\x12\x04\xad\x01\x1e\x1f\n\x0c\n\x04\x04\t\x02\x03\ + \x12\x04\xae\x01\x08\x1a\n\x0f\n\x05\x04\t\x02\x03\x04\x12\x06\xae\x01\ + \x08\xad\x01\x20\n\r\n\x05\x04\t\x02\x03\x05\x12\x04\xae\x01\x08\r\n\r\n\ + \x05\x04\t\x02\x03\x01\x12\x04\xae\x01\x0e\x15\n\r\n\x05\x04\t\x02\x03\ + \x03\x12\x04\xae\x01\x18\x19\n\x0c\n\x02\x04\n\x12\x06\xb1\x01\0\xdc\x01\ + \x01\n\x0b\n\x03\x04\n\x01\x12\x04\xb1\x01\x08\r\nR\n\x04\x04\n\x02\0\ + \x12\x04\xb3\x01\x08P\x1aD\x20UIDMapping\x20specifies\x20user\x20mapping\ + s\x20for\x20supporting\x20user\x20namespaces.\n\n\r\n\x05\x04\n\x02\0\ + \x04\x12\x04\xb3\x01\x08\x10\n\r\n\x05\x04\n\x02\0\x06\x12\x04\xb3\x01\ + \x11\x1f\n\r\n\x05\x04\n\x02\0\x01\x12\x04\xb3\x01\x20+\n\r\n\x05\x04\n\ + \x02\0\x03\x12\x04\xb3\x01./\n\r\n\x05\x04\n\x02\0\x08\x12\x04\xb3\x011O\ + \n\x10\n\x08\x04\n\x02\0\x08\xe9\xfb\x03\x12\x04\xb3\x012N\nS\n\x04\x04\ + \n\x02\x01\x12\x04\xb6\x01\x08P\x1aE\x20GIDMapping\x20specifies\x20group\ + \x20mappings\x20for\x20supporting\x20user\x20namespaces.\n\n\r\n\x05\x04\ + \n\x02\x01\x04\x12\x04\xb6\x01\x08\x10\n\r\n\x05\x04\n\x02\x01\x06\x12\ + \x04\xb6\x01\x11\x1f\n\r\n\x05\x04\n\x02\x01\x01\x12\x04\xb6\x01\x20+\n\ + \r\n\x05\x04\n\x02\x01\x03\x12\x04\xb6\x01./\n\r\n\x05\x04\n\x02\x01\x08\ + \x12\x04\xb6\x011O\n\x10\n\x08\x04\n\x02\x01\x08\xe9\xfb\x03\x12\x04\xb6\ + \x012N\n[\n\x04\x04\n\x02\x02\x12\x04\xb9\x01\x08'\x1aM\x20Sysctl\x20are\ + \x20a\x20set\x20of\x20key\x20value\x20pairs\x20that\x20are\x20set\x20for\ + \x20the\x20container\x20on\x20start\n\n\x0f\n\x05\x04\n\x02\x02\x04\x12\ + \x06\xb9\x01\x08\xb6\x01P\n\r\n\x05\x04\n\x02\x02\x06\x12\x04\xb9\x01\ + \x08\x1b\n\r\n\x05\x04\n\x02\x02\x01\x12\x04\xb9\x01\x1c\"\n\r\n\x05\x04\ + \n\x02\x02\x03\x12\x04\xb9\x01%&\ni\n\x04\x04\n\x02\x03\x12\x04\xbd\x01\ + \x08%\x1a[\x20Resources\x20contain\x20cgroup\x20information\x20for\x20ha\ + ndling\x20resource\x20constraints\n\x20for\x20the\x20container\n\n\x0f\n\ + \x05\x04\n\x02\x03\x04\x12\x06\xbd\x01\x08\xb9\x01'\n\r\n\x05\x04\n\x02\ + \x03\x06\x12\x04\xbd\x01\x08\x16\n\r\n\x05\x04\n\x02\x03\x01\x12\x04\xbd\ + \x01\x17\x20\n\r\n\x05\x04\n\x02\x03\x03\x12\x04\xbd\x01#$\n\x87\x02\n\ + \x04\x04\n\x02\x04\x12\x04\xc2\x01\x08\x1f\x1a\xf8\x01\x20CgroupsPath\ + \x20specifies\x20the\x20path\x20to\x20cgroups\x20that\x20are\x20created\ + \x20and/or\x20joined\x20by\x20the\x20container.\n\x20The\x20path\x20is\ + \x20expected\x20to\x20be\x20relative\x20to\x20the\x20cgroups\x20mountpoi\ + nt.\n\x20If\x20resources\x20are\x20specified,\x20the\x20cgroups\x20at\ + \x20CgroupsPath\x20will\x20be\x20updated\x20based\x20on\x20resources.\n\ + \n\x0f\n\x05\x04\n\x02\x04\x04\x12\x06\xc2\x01\x08\xbd\x01%\n\r\n\x05\ + \x04\n\x02\x04\x05\x12\x04\xc2\x01\x08\x0e\n\r\n\x05\x04\n\x02\x04\x01\ + \x12\x04\xc2\x01\x0f\x1a\n\r\n\x05\x04\n\x02\x04\x03\x12\x04\xc2\x01\x1d\ + \x1e\nb\n\x04\x04\n\x02\x05\x12\x04\xc5\x01\x08O\x1aT\x20Namespaces\x20c\ + ontains\x20the\x20namespaces\x20that\x20are\x20created\x20and/or\x20join\ + ed\x20by\x20the\x20container\n\n\r\n\x05\x04\n\x02\x05\x04\x12\x04\xc5\ + \x01\x08\x10\n\r\n\x05\x04\n\x02\x05\x06\x12\x04\xc5\x01\x11\x1f\n\r\n\ + \x05\x04\n\x02\x05\x01\x12\x04\xc5\x01\x20*\n\r\n\x05\x04\n\x02\x05\x03\ + \x12\x04\xc5\x01-.\n\r\n\x05\x04\n\x02\x05\x08\x12\x04\xc5\x010N\n\x10\n\ + \x08\x04\n\x02\x05\x08\xe9\xfb\x03\x12\x04\xc5\x011M\nU\n\x04\x04\n\x02\ + \x06\x12\x04\xc8\x01\x08I\x1aG\x20Devices\x20are\x20a\x20list\x20of\x20d\ + evice\x20nodes\x20that\x20are\x20created\x20for\x20the\x20container\n\n\ + \r\n\x05\x04\n\x02\x06\x04\x12\x04\xc8\x01\x08\x10\n\r\n\x05\x04\n\x02\ + \x06\x06\x12\x04\xc8\x01\x11\x1c\n\r\n\x05\x04\n\x02\x06\x01\x12\x04\xc8\ + \x01\x1d$\n\r\n\x05\x04\n\x02\x06\x03\x12\x04\xc8\x01'(\n\r\n\x05\x04\n\ + \x02\x06\x08\x12\x04\xc8\x01*H\n\x10\n\x08\x04\n\x02\x06\x08\xe9\xfb\x03\ + \x12\x04\xc8\x01+G\nR\n\x04\x04\n\x02\x07\x12\x04\xcb\x01\x08!\x1aD\x20S\ + eccomp\x20specifies\x20the\x20seccomp\x20security\x20settings\x20for\x20\ + the\x20container.\n\n\x0f\n\x05\x04\n\x02\x07\x04\x12\x06\xcb\x01\x08\ + \xc8\x01I\n\r\n\x05\x04\n\x02\x07\x06\x12\x04\xcb\x01\x08\x14\n\r\n\x05\ + \x04\n\x02\x07\x01\x12\x04\xcb\x01\x15\x1c\n\r\n\x05\x04\n\x02\x07\x03\ + \x12\x04\xcb\x01\x1f\x20\nY\n\x04\x04\n\x02\x08\x12\x04\xce\x01\x08%\x1a\ + K\x20RootfsPropagation\x20is\x20the\x20rootfs\x20mount\x20propagation\ + \x20mode\x20for\x20the\x20container.\n\n\x0f\n\x05\x04\n\x02\x08\x04\x12\ + \x06\xce\x01\x08\xcb\x01!\n\r\n\x05\x04\n\x02\x08\x05\x12\x04\xce\x01\ + \x08\x0e\n\r\n\x05\x04\n\x02\x08\x01\x12\x04\xce\x01\x0f\x20\n\r\n\x05\ + \x04\n\x02\x08\x03\x12\x04\xce\x01#$\nO\n\x04\x04\n\x02\t\x12\x04\xd1\ + \x01\x08)\x1aA\x20MaskedPaths\x20masks\x20over\x20the\x20provided\x20pat\ + hs\x20inside\x20the\x20container.\n\n\r\n\x05\x04\n\x02\t\x04\x12\x04\ + \xd1\x01\x08\x10\n\r\n\x05\x04\n\x02\t\x05\x12\x04\xd1\x01\x11\x17\n\r\n\ + \x05\x04\n\x02\t\x01\x12\x04\xd1\x01\x18#\n\r\n\x05\x04\n\x02\t\x03\x12\ + \x04\xd1\x01&(\nQ\n\x04\x04\n\x02\n\x12\x04\xd4\x01\x08+\x1aC\x20Readonl\ + yPaths\x20sets\x20the\x20provided\x20paths\x20as\x20RO\x20inside\x20the\ + \x20container.\n\n\r\n\x05\x04\n\x02\n\x04\x12\x04\xd4\x01\x08\x10\n\r\n\ + \x05\x04\n\x02\n\x05\x12\x04\xd4\x01\x11\x17\n\r\n\x05\x04\n\x02\n\x01\ + \x12\x04\xd4\x01\x18%\n\r\n\x05\x04\n\x02\n\x03\x12\x04\xd4\x01(*\nY\n\ + \x04\x04\n\x02\x0b\x12\x04\xd7\x01\x08\x1f\x1aK\x20MountLabel\x20specifi\ + es\x20the\x20selinux\x20context\x20for\x20the\x20mounts\x20in\x20the\x20\ + container.\n\n\x0f\n\x05\x04\n\x02\x0b\x04\x12\x06\xd7\x01\x08\xd4\x01+\ + \n\r\n\x05\x04\n\x02\x0b\x05\x12\x04\xd7\x01\x08\x0e\n\r\n\x05\x04\n\x02\ + \x0b\x01\x12\x04\xd7\x01\x0f\x19\n\r\n\x05\x04\n\x02\x0b\x03\x12\x04\xd7\ + \x01\x1c\x1e\n\x9d\x01\n\x04\x04\n\x02\x0c\x12\x04\xdb\x01\x08$\x1a\x8e\ + \x01\x20IntelRdt\x20contains\x20Intel\x20Resource\x20Director\x20Technol\ + ogy\x20(RDT)\x20information\n\x20for\x20handling\x20resource\x20constrai\ + nts\x20(e.g.,\x20L3\x20cache)\x20for\x20the\x20container\n\n\x0f\n\x05\ + \x04\n\x02\x0c\x04\x12\x06\xdb\x01\x08\xd7\x01\x1f\n\r\n\x05\x04\n\x02\ + \x0c\x06\x12\x04\xdb\x01\x08\x15\n\r\n\x05\x04\n\x02\x0c\x01\x12\x04\xdb\ + \x01\x16\x1e\n\r\n\x05\x04\n\x02\x0c\x03\x12\x04\xdb\x01!#\n\x0c\n\x02\ + \x04\x0b\x12\x06\xde\x01\0\xe1\x01\x01\n\x0b\n\x03\x04\x0b\x01\x12\x04\ + \xde\x01\x08\x0f\n)\n\x04\x04\x0b\x02\0\x12\x04\xe0\x01\x08\x19\x1a\x1b\ + \x20Dummy\x20string,\x20never\x20used.\n\n\x0f\n\x05\x04\x0b\x02\0\x04\ + \x12\x06\xe0\x01\x08\xde\x01\x11\n\r\n\x05\x04\x0b\x02\0\x05\x12\x04\xe0\ + \x01\x08\x0e\n\r\n\x05\x04\x0b\x02\0\x01\x12\x04\xe0\x01\x0f\x14\n\r\n\ + \x05\x04\x0b\x02\0\x03\x12\x04\xe0\x01\x17\x18\n\x0c\n\x02\x04\x0c\x12\ + \x06\xe3\x01\0\xe6\x01\x01\n\x0b\n\x03\x04\x0c\x01\x12\x04\xe3\x01\x08\ + \x0f\n)\n\x04\x04\x0c\x02\0\x12\x04\xe5\x01\x08\x19\x1a\x1b\x20Dummy\x20\ + string,\x20never\x20used.\n\n\x0f\n\x05\x04\x0c\x02\0\x04\x12\x06\xe5\ + \x01\x08\xe3\x01\x11\n\r\n\x05\x04\x0c\x02\0\x05\x12\x04\xe5\x01\x08\x0e\ + \n\r\n\x05\x04\x0c\x02\0\x01\x12\x04\xe5\x01\x0f\x14\n\r\n\x05\x04\x0c\ + \x02\0\x03\x12\x04\xe5\x01\x17\x18\n\x0c\n\x02\x04\r\x12\x06\xe8\x01\0\ + \xf1\x01\x01\n\x0b\n\x03\x04\r\x01\x12\x04\xe8\x01\x08\x16\nX\n\x04\x04\ + \r\x02\0\x12\x04\xea\x01\x08\x1a\x1aJ\x20HostID\x20is\x20the\x20starting\ + \x20UID/GID\x20on\x20the\x20host\x20to\x20be\x20mapped\x20to\x20'Contain\ + erID'\n\n\x0f\n\x05\x04\r\x02\0\x04\x12\x06\xea\x01\x08\xe8\x01\x18\n\r\ + \n\x05\x04\r\x02\0\x05\x12\x04\xea\x01\x08\x0e\n\r\n\x05\x04\r\x02\0\x01\ + \x12\x04\xea\x01\x0f\x15\n\r\n\x05\x04\r\x02\0\x03\x12\x04\xea\x01\x18\ + \x19\nD\n\x04\x04\r\x02\x01\x12\x04\xed\x01\x08\x1f\x1a6\x20ContainerID\ + \x20is\x20the\x20starting\x20UID/GID\x20in\x20the\x20container\n\n\x0f\n\ + \x05\x04\r\x02\x01\x04\x12\x06\xed\x01\x08\xea\x01\x1a\n\r\n\x05\x04\r\ + \x02\x01\x05\x12\x04\xed\x01\x08\x0e\n\r\n\x05\x04\r\x02\x01\x01\x12\x04\ + \xed\x01\x0f\x1a\n\r\n\x05\x04\r\x02\x01\x03\x12\x04\xed\x01\x1d\x1e\n6\ + \n\x04\x04\r\x02\x02\x12\x04\xf0\x01\x08\x18\x1a(\x20Size\x20is\x20the\ + \x20number\x20of\x20IDs\x20to\x20be\x20mapped\n\n\x0f\n\x05\x04\r\x02\ + \x02\x04\x12\x06\xf0\x01\x08\xed\x01\x1f\n\r\n\x05\x04\r\x02\x02\x05\x12\ + \x04\xf0\x01\x08\x0e\n\r\n\x05\x04\r\x02\x02\x01\x12\x04\xf0\x01\x0f\x13\ + \n\r\n\x05\x04\r\x02\x02\x03\x12\x04\xf0\x01\x16\x17\n\x0c\n\x02\x04\x0e\ + \x12\x06\xf3\x01\0\xfa\x01\x01\n\x0b\n\x03\x04\x0e\x01\x12\x04\xf3\x01\ + \x08\x16\n-\n\x04\x04\x0e\x02\0\x12\x04\xf5\x01\x08\x18\x1a\x1f\x20Type\ + \x20is\x20the\x20type\x20of\x20namespace\n\n\x0f\n\x05\x04\x0e\x02\0\x04\ + \x12\x06\xf5\x01\x08\xf3\x01\x18\n\r\n\x05\x04\x0e\x02\0\x05\x12\x04\xf5\ + \x01\x08\x0e\n\r\n\x05\x04\x0e\x02\0\x01\x12\x04\xf5\x01\x0f\x13\n\r\n\ + \x05\x04\x0e\x02\0\x03\x12\x04\xf5\x01\x16\x17\nu\n\x04\x04\x0e\x02\x01\ + \x12\x04\xf9\x01\x08\x18\x1ag\x20Path\x20is\x20a\x20path\x20to\x20an\x20\ + existing\x20namespace\x20persisted\x20on\x20disk\x20that\x20can\x20be\ + \x20joined\n\x20and\x20is\x20of\x20the\x20same\x20type\n\n\x0f\n\x05\x04\ + \x0e\x02\x01\x04\x12\x06\xf9\x01\x08\xf5\x01\x18\n\r\n\x05\x04\x0e\x02\ + \x01\x05\x12\x04\xf9\x01\x08\x0e\n\r\n\x05\x04\x0e\x02\x01\x01\x12\x04\ + \xf9\x01\x0f\x13\n\r\n\x05\x04\x0e\x02\x01\x03\x12\x04\xf9\x01\x16\x17\n\ + \x0c\n\x02\x04\x0f\x12\x06\xfc\x01\0\x91\x02\x01\n\x0b\n\x03\x04\x0f\x01\ + \x12\x04\xfc\x01\x08\x13\n#\n\x04\x04\x0f\x02\0\x12\x04\xfe\x01\x08\x18\ + \x1a\x15\x20Path\x20to\x20the\x20device.\n\n\x0f\n\x05\x04\x0f\x02\0\x04\ + \x12\x06\xfe\x01\x08\xfc\x01\x15\n\r\n\x05\x04\x0f\x02\0\x05\x12\x04\xfe\ + \x01\x08\x0e\n\r\n\x05\x04\x0f\x02\0\x01\x12\x04\xfe\x01\x0f\x13\n\r\n\ + \x05\x04\x0f\x02\0\x03\x12\x04\xfe\x01\x16\x17\n.\n\x04\x04\x0f\x02\x01\ + \x12\x04\x81\x02\x08\x18\x1a\x20\x20Device\x20type,\x20block,\x20char,\ + \x20etc.\n\n\x0f\n\x05\x04\x0f\x02\x01\x04\x12\x06\x81\x02\x08\xfe\x01\ + \x18\n\r\n\x05\x04\x0f\x02\x01\x05\x12\x04\x81\x02\x08\x0e\n\r\n\x05\x04\ + \x0f\x02\x01\x01\x12\x04\x81\x02\x0f\x13\n\r\n\x05\x04\x0f\x02\x01\x03\ + \x12\x04\x81\x02\x16\x17\n3\n\x04\x04\x0f\x02\x02\x12\x04\x84\x02\x08\ + \x18\x1a%\x20Major\x20is\x20the\x20device's\x20major\x20number.\n\n\x0f\ + \n\x05\x04\x0f\x02\x02\x04\x12\x06\x84\x02\x08\x81\x02\x18\n\r\n\x05\x04\ + \x0f\x02\x02\x05\x12\x04\x84\x02\x08\r\n\r\n\x05\x04\x0f\x02\x02\x01\x12\ + \x04\x84\x02\x0e\x13\n\r\n\x05\x04\x0f\x02\x02\x03\x12\x04\x84\x02\x16\ + \x17\n3\n\x04\x04\x0f\x02\x03\x12\x04\x87\x02\x08\x18\x1a%\x20Minor\x20i\ + s\x20the\x20device's\x20minor\x20number.\n\n\x0f\n\x05\x04\x0f\x02\x03\ + \x04\x12\x06\x87\x02\x08\x84\x02\x18\n\r\n\x05\x04\x0f\x02\x03\x05\x12\ + \x04\x87\x02\x08\r\n\r\n\x05\x04\x0f\x02\x03\x01\x12\x04\x87\x02\x0e\x13\ + \n\r\n\x05\x04\x0f\x02\x03\x03\x12\x04\x87\x02\x16\x17\n8\n\x04\x04\x0f\ + \x02\x04\x12\x04\x8a\x02\x08\x1c\x1a*\x20FileMode\x20permission\x20bits\ + \x20for\x20the\x20device.\n\n\x0f\n\x05\x04\x0f\x02\x04\x04\x12\x06\x8a\ + \x02\x08\x87\x02\x18\n\r\n\x05\x04\x0f\x02\x04\x05\x12\x04\x8a\x02\x08\ + \x0e\n\r\n\x05\x04\x0f\x02\x04\x01\x12\x04\x8a\x02\x0f\x17\n\r\n\x05\x04\ + \x0f\x02\x04\x03\x12\x04\x8a\x02\x1a\x1b\n\"\n\x04\x04\x0f\x02\x05\x12\ + \x04\x8d\x02\x08\x17\x1a\x14\x20UID\x20of\x20the\x20device.\n\n\x0f\n\ + \x05\x04\x0f\x02\x05\x04\x12\x06\x8d\x02\x08\x8a\x02\x1c\n\r\n\x05\x04\ + \x0f\x02\x05\x05\x12\x04\x8d\x02\x08\x0e\n\r\n\x05\x04\x0f\x02\x05\x01\ + \x12\x04\x8d\x02\x0f\x12\n\r\n\x05\x04\x0f\x02\x05\x03\x12\x04\x8d\x02\ + \x15\x16\n\"\n\x04\x04\x0f\x02\x06\x12\x04\x90\x02\x08\x17\x1a\x14\x20Gi\ + d\x20of\x20the\x20device.\n\n\x0f\n\x05\x04\x0f\x02\x06\x04\x12\x06\x90\ + \x02\x08\x8d\x02\x17\n\r\n\x05\x04\x0f\x02\x06\x05\x12\x04\x90\x02\x08\ + \x0e\n\r\n\x05\x04\x0f\x02\x06\x01\x12\x04\x90\x02\x0f\x12\n\r\n\x05\x04\ + \x0f\x02\x06\x03\x12\x04\x90\x02\x15\x16\n\x0c\n\x02\x04\x10\x12\x06\x93\ + \x02\0\xa8\x02\x01\n\x0b\n\x03\x04\x10\x01\x12\x04\x93\x02\x08\x16\n8\n\ + \x04\x04\x10\x02\0\x12\x04\x95\x02\x08O\x1a*\x20Devices\x20configures\ + \x20the\x20device\x20whitelist.\n\n\r\n\x05\x04\x10\x02\0\x04\x12\x04\ + \x95\x02\x08\x10\n\r\n\x05\x04\x10\x02\0\x06\x12\x04\x95\x02\x11\"\n\r\n\ + \x05\x04\x10\x02\0\x01\x12\x04\x95\x02#*\n\r\n\x05\x04\x10\x02\0\x03\x12\ + \x04\x95\x02-.\n\r\n\x05\x04\x10\x02\0\x08\x12\x04\x95\x020N\n\x10\n\x08\ + \x04\x10\x02\0\x08\xe9\xfb\x03\x12\x04\x95\x021M\n0\n\x04\x04\x10\x02\ + \x01\x12\x04\x98\x02\x08\x1f\x1a\"\x20Memory\x20restriction\x20configura\ + tion\n\n\x0f\n\x05\x04\x10\x02\x01\x04\x12\x06\x98\x02\x08\x95\x02O\n\r\ + \n\x05\x04\x10\x02\x01\x06\x12\x04\x98\x02\x08\x13\n\r\n\x05\x04\x10\x02\ + \x01\x01\x12\x04\x98\x02\x14\x1a\n\r\n\x05\x04\x10\x02\x01\x03\x12\x04\ + \x98\x02\x1d\x1e\n6\n\x04\x04\x10\x02\x02\x12\x04\x9b\x02\x08\x19\x1a(\ + \x20CPU\x20resource\x20restriction\x20configuration\n\n\x0f\n\x05\x04\ + \x10\x02\x02\x04\x12\x06\x9b\x02\x08\x98\x02\x1f\n\r\n\x05\x04\x10\x02\ + \x02\x06\x12\x04\x9b\x02\x08\x10\n\r\n\x05\x04\x10\x02\x02\x01\x12\x04\ + \x9b\x02\x11\x14\n\r\n\x05\x04\x10\x02\x02\x03\x12\x04\x9b\x02\x17\x18\n\ + 8\n\x04\x04\x10\x02\x03\x12\x04\x9e\x02\x08\x1b\x1a*\x20Task\x20resource\ + \x20restriction\x20configuration.\n\n\x0f\n\x05\x04\x10\x02\x03\x04\x12\ + \x06\x9e\x02\x08\x9b\x02\x19\n\r\n\x05\x04\x10\x02\x03\x06\x12\x04\x9e\ + \x02\x08\x11\n\r\n\x05\x04\x10\x02\x03\x01\x12\x04\x9e\x02\x12\x16\n\r\n\ + \x05\x04\x10\x02\x03\x03\x12\x04\x9e\x02\x19\x1a\n1\n\x04\x04\x10\x02\ + \x04\x12\x04\xa1\x02\x08!\x1a#\x20BlockIO\x20restriction\x20configuratio\ + n\n\n\x0f\n\x05\x04\x10\x02\x04\x04\x12\x06\xa1\x02\x08\x9e\x02\x1b\n\r\ + \n\x05\x04\x10\x02\x04\x06\x12\x04\xa1\x02\x08\x14\n\r\n\x05\x04\x10\x02\ + \x04\x01\x12\x04\xa1\x02\x15\x1c\n\r\n\x05\x04\x10\x02\x04\x03\x12\x04\ + \xa1\x02\x1f\x20\n(\n\x04\x04\x10\x02\x05\x12\x04\xa4\x02\x08W\x1a\x1a\ + \x20Hugetlb\x20limit\x20(in\x20bytes)\n\n\r\n\x05\x04\x10\x02\x05\x04\ + \x12\x04\xa4\x02\x08\x10\n\r\n\x05\x04\x10\x02\x05\x06\x12\x04\xa4\x02\ + \x11#\n\r\n\x05\x04\x10\x02\x05\x01\x12\x04\xa4\x02$2\n\r\n\x05\x04\x10\ + \x02\x05\x03\x12\x04\xa4\x0256\n\r\n\x05\x04\x10\x02\x05\x08\x12\x04\xa4\ + \x028V\n\x10\n\x08\x04\x10\x02\x05\x08\xe9\xfb\x03\x12\x04\xa4\x029U\n1\ + \n\x04\x04\x10\x02\x06\x12\x04\xa7\x02\x08!\x1a#\x20Network\x20restricti\ + on\x20configuration\n\n\x0f\n\x05\x04\x10\x02\x06\x04\x12\x06\xa7\x02\ + \x08\xa4\x02W\n\r\n\x05\x04\x10\x02\x06\x06\x12\x04\xa7\x02\x08\x14\n\r\ + \n\x05\x04\x10\x02\x06\x01\x12\x04\xa7\x02\x15\x1c\n\r\n\x05\x04\x10\x02\ + \x06\x03\x12\x04\xa7\x02\x1f\x20\n\x0c\n\x02\x04\x11\x12\x06\xaa\x02\0\ + \xbf\x02\x01\n\x0b\n\x03\x04\x11\x01\x12\x04\xaa\x02\x08\x13\n(\n\x04\ + \x04\x11\x02\0\x12\x04\xac\x02\x08\x18\x1a\x1a\x20Memory\x20limit\x20(in\ + \x20bytes).\n\n\x0f\n\x05\x04\x11\x02\0\x04\x12\x06\xac\x02\x08\xaa\x02\ + \x15\n\r\n\x05\x04\x11\x02\0\x05\x12\x04\xac\x02\x08\r\n\r\n\x05\x04\x11\ + \x02\0\x01\x12\x04\xac\x02\x0e\x13\n\r\n\x05\x04\x11\x02\0\x03\x12\x04\ + \xac\x02\x16\x17\n<\n\x04\x04\x11\x02\x01\x12\x04\xaf\x02\x08\x1e\x1a.\ + \x20Memory\x20reservation\x20or\x20soft_limit\x20(in\x20bytes).\n\n\x0f\ + \n\x05\x04\x11\x02\x01\x04\x12\x06\xaf\x02\x08\xac\x02\x18\n\r\n\x05\x04\ + \x11\x02\x01\x05\x12\x04\xaf\x02\x08\r\n\r\n\x05\x04\x11\x02\x01\x01\x12\ + \x04\xaf\x02\x0e\x19\n\r\n\x05\x04\x11\x02\x01\x03\x12\x04\xaf\x02\x1c\ + \x1d\n3\n\x04\x04\x11\x02\x02\x12\x04\xb2\x02\x08\x17\x1a%\x20Total\x20m\ + emory\x20limit\x20(memory\x20+\x20swap).\n\n\x0f\n\x05\x04\x11\x02\x02\ + \x04\x12\x06\xb2\x02\x08\xaf\x02\x1e\n\r\n\x05\x04\x11\x02\x02\x05\x12\ + \x04\xb2\x02\x08\r\n\r\n\x05\x04\x11\x02\x02\x01\x12\x04\xb2\x02\x0e\x12\ + \n\r\n\x05\x04\x11\x02\x02\x03\x12\x04\xb2\x02\x15\x16\n/\n\x04\x04\x11\ + \x02\x03\x12\x04\xb5\x02\x08\x19\x1a!\x20Kernel\x20memory\x20limit\x20(i\ + n\x20bytes).\n\n\x0f\n\x05\x04\x11\x02\x03\x04\x12\x06\xb5\x02\x08\xb2\ + \x02\x17\n\r\n\x05\x04\x11\x02\x03\x05\x12\x04\xb5\x02\x08\r\n\r\n\x05\ + \x04\x11\x02\x03\x01\x12\x04\xb5\x02\x0e\x14\n\r\n\x05\x04\x11\x02\x03\ + \x03\x12\x04\xb5\x02\x17\x18\n6\n\x04\x04\x11\x02\x04\x12\x04\xb8\x02\ + \x08\x1c\x1a(\x20Kernel\x20memory\x20limit\x20for\x20tcp\x20(in\x20bytes\ + )\n\n\x0f\n\x05\x04\x11\x02\x04\x04\x12\x06\xb8\x02\x08\xb5\x02\x19\n\r\ + \n\x05\x04\x11\x02\x04\x05\x12\x04\xb8\x02\x08\r\n\r\n\x05\x04\x11\x02\ + \x04\x01\x12\x04\xb8\x02\x0e\x17\n\r\n\x05\x04\x11\x02\x04\x03\x12\x04\ + \xb8\x02\x1a\x1b\nA\n\x04\x04\x11\x02\x05\x12\x04\xbb\x02\x08\x1e\x1a3\ + \x20How\x20aggressive\x20the\x20kernel\x20will\x20swap\x20memory\x20page\ + s.\n\n\x0f\n\x05\x04\x11\x02\x05\x04\x12\x06\xbb\x02\x08\xb8\x02\x1c\n\r\ + \n\x05\x04\x11\x02\x05\x05\x12\x04\xbb\x02\x08\x0e\n\r\n\x05\x04\x11\x02\ + \x05\x01\x12\x04\xbb\x02\x0f\x19\n\r\n\x05\x04\x11\x02\x05\x03\x12\x04\ + \xbb\x02\x1c\x1d\nU\n\x04\x04\x11\x02\x06\x12\x04\xbe\x02\x08\"\x1aG\x20\ + DisableOOMKiller\x20disables\x20the\x20OOM\x20killer\x20for\x20out\x20of\ + \x20memory\x20conditions\n\n\x0f\n\x05\x04\x11\x02\x06\x04\x12\x06\xbe\ + \x02\x08\xbb\x02\x1e\n\r\n\x05\x04\x11\x02\x06\x05\x12\x04\xbe\x02\x08\ + \x0c\n\r\n\x05\x04\x11\x02\x06\x01\x12\x04\xbe\x02\r\x1d\n\r\n\x05\x04\ + \x11\x02\x06\x03\x12\x04\xbe\x02\x20!\n\x0c\n\x02\x04\x12\x12\x06\xc1\ + \x02\0\xd6\x02\x01\n\x0b\n\x03\x04\x12\x01\x12\x04\xc1\x02\x08\x10\nW\n\ + \x04\x04\x12\x02\0\x12\x04\xc3\x02\x08\x1a\x1aI\x20CPU\x20shares\x20(rel\ + ative\x20weight\x20(ratio)\x20vs.\x20other\x20cgroups\x20with\x20cpu\x20\ + shares).\n\n\x0f\n\x05\x04\x12\x02\0\x04\x12\x06\xc3\x02\x08\xc1\x02\x12\ + \n\r\n\x05\x04\x12\x02\0\x05\x12\x04\xc3\x02\x08\x0e\n\r\n\x05\x04\x12\ + \x02\0\x01\x12\x04\xc3\x02\x0f\x15\n\r\n\x05\x04\x12\x02\0\x03\x12\x04\ + \xc3\x02\x18\x19\nQ\n\x04\x04\x12\x02\x01\x12\x04\xc6\x02\x08\x18\x1aC\ + \x20CPU\x20hardcap\x20limit\x20(in\x20usecs).\x20Allowed\x20cpu\x20time\ + \x20in\x20a\x20given\x20period.\n\n\x0f\n\x05\x04\x12\x02\x01\x04\x12\ + \x06\xc6\x02\x08\xc3\x02\x1a\n\r\n\x05\x04\x12\x02\x01\x05\x12\x04\xc6\ + \x02\x08\r\n\r\n\x05\x04\x12\x02\x01\x01\x12\x04\xc6\x02\x0e\x13\n\r\n\ + \x05\x04\x12\x02\x01\x03\x12\x04\xc6\x02\x16\x17\nA\n\x04\x04\x12\x02\ + \x02\x12\x04\xc9\x02\x08\x1a\x1a3\x20CPU\x20period\x20to\x20be\x20used\ + \x20for\x20hardcapping\x20(in\x20usecs).\n\n\x0f\n\x05\x04\x12\x02\x02\ + \x04\x12\x06\xc9\x02\x08\xc6\x02\x18\n\r\n\x05\x04\x12\x02\x02\x05\x12\ + \x04\xc9\x02\x08\x0e\n\r\n\x05\x04\x12\x02\x02\x01\x12\x04\xc9\x02\x0f\ + \x15\n\r\n\x05\x04\x12\x02\x02\x03\x12\x04\xc9\x02\x18\x19\nE\n\x04\x04\ + \x12\x02\x03\x12\x04\xcc\x02\x08\"\x1a7\x20How\x20much\x20time\x20realti\ + me\x20scheduling\x20may\x20use\x20(in\x20usecs).\n\n\x0f\n\x05\x04\x12\ + \x02\x03\x04\x12\x06\xcc\x02\x08\xc9\x02\x1a\n\r\n\x05\x04\x12\x02\x03\ + \x05\x12\x04\xcc\x02\x08\r\n\r\n\x05\x04\x12\x02\x03\x01\x12\x04\xcc\x02\ + \x0e\x1d\n\r\n\x05\x04\x12\x02\x03\x03\x12\x04\xcc\x02\x20!\nI\n\x04\x04\ + \x12\x02\x04\x12\x04\xcf\x02\x08\"\x1a;\x20CPU\x20period\x20to\x20be\x20\ + used\x20for\x20realtime\x20scheduling\x20(in\x20usecs).\n\n\x0f\n\x05\ + \x04\x12\x02\x04\x04\x12\x06\xcf\x02\x08\xcc\x02\"\n\r\n\x05\x04\x12\x02\ + \x04\x05\x12\x04\xcf\x02\x08\x0e\n\r\n\x05\x04\x12\x02\x04\x01\x12\x04\ + \xcf\x02\x0f\x1d\n\r\n\x05\x04\x12\x02\x04\x03\x12\x04\xcf\x02\x20!\nS\n\ + \x04\x04\x12\x02\x05\x12\x04\xd2\x02\x08\x18\x1aE\x20CPUs\x20to\x20use\ + \x20within\x20the\x20cpuset.\x20Default\x20is\x20to\x20use\x20any\x20CPU\ + \x20available.\n\n\x0f\n\x05\x04\x12\x02\x05\x04\x12\x06\xd2\x02\x08\xcf\ + \x02\"\n\r\n\x05\x04\x12\x02\x05\x05\x12\x04\xd2\x02\x08\x0e\n\r\n\x05\ + \x04\x12\x02\x05\x01\x12\x04\xd2\x02\x0f\x13\n\r\n\x05\x04\x12\x02\x05\ + \x03\x12\x04\xd2\x02\x16\x17\n`\n\x04\x04\x12\x02\x06\x12\x04\xd5\x02\ + \x08\x18\x1aR\x20List\x20of\x20memory\x20nodes\x20in\x20the\x20cpuset.\ + \x20Default\x20is\x20to\x20use\x20any\x20available\x20memory\x20node.\n\ + \n\x0f\n\x05\x04\x12\x02\x06\x04\x12\x06\xd5\x02\x08\xd2\x02\x18\n\r\n\ + \x05\x04\x12\x02\x06\x05\x12\x04\xd5\x02\x08\x0e\n\r\n\x05\x04\x12\x02\ + \x06\x01\x12\x04\xd5\x02\x0f\x13\n\r\n\x05\x04\x12\x02\x06\x03\x12\x04\ + \xd5\x02\x16\x17\n\x0c\n\x02\x04\x13\x12\x06\xd8\x02\0\xe4\x02\x01\n\x0b\ + \n\x03\x04\x13\x01\x12\x04\xd8\x02\x08\x19\n3\n\x04\x04\x13\x02\0\x12\ + \x04\xda\x02\x08\x18\x1a%\x20Major\x20is\x20the\x20device's\x20major\x20\ + number.\n\n\x0f\n\x05\x04\x13\x02\0\x04\x12\x06\xda\x02\x08\xd8\x02\x1b\ + \n\r\n\x05\x04\x13\x02\0\x05\x12\x04\xda\x02\x08\r\n\r\n\x05\x04\x13\x02\ + \0\x01\x12\x04\xda\x02\x0e\x13\n\r\n\x05\x04\x13\x02\0\x03\x12\x04\xda\ + \x02\x16\x17\n3\n\x04\x04\x13\x02\x01\x12\x04\xdd\x02\x08\x18\x1a%\x20Mi\ + nor\x20is\x20the\x20device's\x20minor\x20number.\n\n\x0f\n\x05\x04\x13\ + \x02\x01\x04\x12\x06\xdd\x02\x08\xda\x02\x18\n\r\n\x05\x04\x13\x02\x01\ + \x05\x12\x04\xdd\x02\x08\r\n\r\n\x05\x04\x13\x02\x01\x01\x12\x04\xdd\x02\ + \x0e\x13\n\r\n\x05\x04\x13\x02\x01\x03\x12\x04\xdd\x02\x16\x17\n<\n\x04\ + \x04\x13\x02\x02\x12\x04\xe0\x02\x08\x1a\x1a.\x20Weight\x20is\x20the\x20\ + bandwidth\x20rate\x20for\x20the\x20device.\n\n\x0f\n\x05\x04\x13\x02\x02\ + \x04\x12\x06\xe0\x02\x08\xdd\x02\x18\n\r\n\x05\x04\x13\x02\x02\x05\x12\ + \x04\xe0\x02\x08\x0e\n\r\n\x05\x04\x13\x02\x02\x01\x12\x04\xe0\x02\x0f\ + \x15\n\r\n\x05\x04\x13\x02\x02\x03\x12\x04\xe0\x02\x18\x19\n\x83\x01\n\ + \x04\x04\x13\x02\x03\x12\x04\xe3\x02\x08\x1e\x1au\x20LeafWeight\x20is\ + \x20the\x20bandwidth\x20rate\x20for\x20the\x20device\x20while\x20competi\ + ng\x20with\x20the\x20cgroup's\x20child\x20cgroups,\x20CFQ\x20scheduler\ + \x20only\n\n\x0f\n\x05\x04\x13\x02\x03\x04\x12\x06\xe3\x02\x08\xe0\x02\ + \x1a\n\r\n\x05\x04\x13\x02\x03\x05\x12\x04\xe3\x02\x08\x0e\n\r\n\x05\x04\ + \x13\x02\x03\x01\x12\x04\xe3\x02\x0f\x19\n\r\n\x05\x04\x13\x02\x03\x03\ + \x12\x04\xe3\x02\x1c\x1d\n\x0c\n\x02\x04\x14\x12\x06\xe6\x02\0\xef\x02\ + \x01\n\x0b\n\x03\x04\x14\x01\x12\x04\xe6\x02\x08\x1b\n3\n\x04\x04\x14\ + \x02\0\x12\x04\xe8\x02\x08\x18\x1a%\x20Major\x20is\x20the\x20device's\ + \x20major\x20number.\n\n\x0f\n\x05\x04\x14\x02\0\x04\x12\x06\xe8\x02\x08\ + \xe6\x02\x1d\n\r\n\x05\x04\x14\x02\0\x05\x12\x04\xe8\x02\x08\r\n\r\n\x05\ + \x04\x14\x02\0\x01\x12\x04\xe8\x02\x0e\x13\n\r\n\x05\x04\x14\x02\0\x03\ + \x12\x04\xe8\x02\x16\x17\n3\n\x04\x04\x14\x02\x01\x12\x04\xeb\x02\x08\ + \x18\x1a%\x20Minor\x20is\x20the\x20device's\x20minor\x20number.\n\n\x0f\ + \n\x05\x04\x14\x02\x01\x04\x12\x06\xeb\x02\x08\xe8\x02\x18\n\r\n\x05\x04\ + \x14\x02\x01\x05\x12\x04\xeb\x02\x08\r\n\r\n\x05\x04\x14\x02\x01\x01\x12\ + \x04\xeb\x02\x0e\x13\n\r\n\x05\x04\x14\x02\x01\x03\x12\x04\xeb\x02\x16\ + \x17\n?\n\x04\x04\x14\x02\x02\x12\x04\xee\x02\x08\x18\x1a1\x20Rate\x20is\ + \x20the\x20IO\x20rate\x20limit\x20per\x20cgroup\x20per\x20device\n\n\x0f\ + \n\x05\x04\x14\x02\x02\x04\x12\x06\xee\x02\x08\xeb\x02\x18\n\r\n\x05\x04\ + \x14\x02\x02\x05\x12\x04\xee\x02\x08\x0e\n\r\n\x05\x04\x14\x02\x02\x01\ + \x12\x04\xee\x02\x0f\x13\n\r\n\x05\x04\x14\x02\x02\x03\x12\x04\xee\x02\ + \x16\x17\n\x0c\n\x02\x04\x15\x12\x06\xf1\x02\0\x86\x03\x01\n\x0b\n\x03\ + \x04\x15\x01\x12\x04\xf1\x02\x08\x14\n+\n\x04\x04\x15\x02\0\x12\x04\xf3\ + \x02\x08\x1a\x1a\x1d\x20Specifies\x20per\x20cgroup\x20weight\n\n\x0f\n\ + \x05\x04\x15\x02\0\x04\x12\x06\xf3\x02\x08\xf1\x02\x16\n\r\n\x05\x04\x15\ + \x02\0\x05\x12\x04\xf3\x02\x08\x0e\n\r\n\x05\x04\x15\x02\0\x01\x12\x04\ + \xf3\x02\x0f\x15\n\r\n\x05\x04\x15\x02\0\x03\x12\x04\xf3\x02\x18\x19\n\ + \x7f\n\x04\x04\x15\x02\x01\x12\x04\xf6\x02\x08\x1e\x1aq\x20Specifies\x20\ + tasks'\x20weight\x20in\x20the\x20given\x20cgroup\x20while\x20competing\ + \x20with\x20the\x20cgroup's\x20child\x20cgroups,\x20CFQ\x20scheduler\x20\ + only\n\n\x0f\n\x05\x04\x15\x02\x01\x04\x12\x06\xf6\x02\x08\xf3\x02\x1a\n\ + \r\n\x05\x04\x15\x02\x01\x05\x12\x04\xf6\x02\x08\x0e\n\r\n\x05\x04\x15\ + \x02\x01\x01\x12\x04\xf6\x02\x0f\x19\n\r\n\x05\x04\x15\x02\x01\x03\x12\ + \x04\xf6\x02\x1c\x1d\nF\n\x04\x04\x15\x02\x02\x12\x04\xf9\x02\x08T\x1a8\ + \x20Weight\x20per\x20cgroup\x20per\x20device,\x20can\x20override\x20Blki\ + oWeight\n\n\r\n\x05\x04\x15\x02\x02\x04\x12\x04\xf9\x02\x08\x10\n\r\n\ + \x05\x04\x15\x02\x02\x06\x12\x04\xf9\x02\x11\"\n\r\n\x05\x04\x15\x02\x02\ + \x01\x12\x04\xf9\x02#/\n\r\n\x05\x04\x15\x02\x02\x03\x12\x04\xf9\x0223\n\ + \r\n\x05\x04\x15\x02\x02\x08\x12\x04\xf9\x025S\n\x10\n\x08\x04\x15\x02\ + \x02\x08\xe9\xfb\x03\x12\x04\xf9\x026R\nJ\n\x04\x04\x15\x02\x03\x12\x04\ + \xfc\x02\x08_\x1a<\x20IO\x20read\x20rate\x20limit\x20per\x20cgroup\x20pe\ + r\x20device,\x20bytes\x20per\x20second\n\n\r\n\x05\x04\x15\x02\x03\x04\ + \x12\x04\xfc\x02\x08\x10\n\r\n\x05\x04\x15\x02\x03\x06\x12\x04\xfc\x02\ + \x11$\n\r\n\x05\x04\x15\x02\x03\x01\x12\x04\xfc\x02%:\n\r\n\x05\x04\x15\ + \x02\x03\x03\x12\x04\xfc\x02=>\n\r\n\x05\x04\x15\x02\x03\x08\x12\x04\xfc\ + \x02@^\n\x10\n\x08\x04\x15\x02\x03\x08\xe9\xfb\x03\x12\x04\xfc\x02A]\nK\ + \n\x04\x04\x15\x02\x04\x12\x04\xff\x02\x08`\x1a=\x20IO\x20write\x20rate\ + \x20limit\x20per\x20cgroup\x20per\x20device,\x20bytes\x20per\x20second\n\ + \n\r\n\x05\x04\x15\x02\x04\x04\x12\x04\xff\x02\x08\x10\n\r\n\x05\x04\x15\ + \x02\x04\x06\x12\x04\xff\x02\x11$\n\r\n\x05\x04\x15\x02\x04\x01\x12\x04\ + \xff\x02%;\n\r\n\x05\x04\x15\x02\x04\x03\x12\x04\xff\x02>?\n\r\n\x05\x04\ + \x15\x02\x04\x08\x12\x04\xff\x02A_\n\x10\n\x08\x04\x15\x02\x04\x08\xe9\ + \xfb\x03\x12\x04\xff\x02B^\nG\n\x04\x04\x15\x02\x05\x12\x04\x82\x03\x08`\ + \x1a9\x20IO\x20read\x20rate\x20limit\x20per\x20cgroup\x20per\x20device,\ + \x20IO\x20per\x20second\n\n\r\n\x05\x04\x15\x02\x05\x04\x12\x04\x82\x03\ + \x08\x10\n\r\n\x05\x04\x15\x02\x05\x06\x12\x04\x82\x03\x11$\n\r\n\x05\ + \x04\x15\x02\x05\x01\x12\x04\x82\x03%;\n\r\n\x05\x04\x15\x02\x05\x03\x12\ + \x04\x82\x03>?\n\r\n\x05\x04\x15\x02\x05\x08\x12\x04\x82\x03A_\n\x10\n\ + \x08\x04\x15\x02\x05\x08\xe9\xfb\x03\x12\x04\x82\x03B^\nH\n\x04\x04\x15\ + \x02\x06\x12\x04\x85\x03\x08a\x1a:\x20IO\x20write\x20rate\x20limit\x20pe\ + r\x20cgroup\x20per\x20device,\x20IO\x20per\x20second\n\n\r\n\x05\x04\x15\ + \x02\x06\x04\x12\x04\x85\x03\x08\x10\n\r\n\x05\x04\x15\x02\x06\x06\x12\ + \x04\x85\x03\x11$\n\r\n\x05\x04\x15\x02\x06\x01\x12\x04\x85\x03%<\n\r\n\ + \x05\x04\x15\x02\x06\x03\x12\x04\x85\x03?@\n\r\n\x05\x04\x15\x02\x06\x08\ + \x12\x04\x85\x03B`\n\x10\n\x08\x04\x15\x02\x06\x08\xe9\xfb\x03\x12\x04\ + \x85\x03C_\n\x0c\n\x02\x04\x16\x12\x06\x88\x03\0\x8b\x03\x01\n\x0b\n\x03\ + \x04\x16\x01\x12\x04\x88\x03\x08\x11\n>\n\x04\x04\x16\x02\0\x12\x04\x8a\ + \x03\x08\x18\x1a0\x20Maximum\x20number\x20of\x20PIDs.\x20Default\x20is\ + \x20\"no\x20limit\".\n\n\x0f\n\x05\x04\x16\x02\0\x04\x12\x06\x8a\x03\x08\ + \x88\x03\x13\n\r\n\x05\x04\x16\x02\0\x05\x12\x04\x8a\x03\x08\r\n\r\n\x05\ + \x04\x16\x02\0\x01\x12\x04\x8a\x03\x0e\x13\n\r\n\x05\x04\x16\x02\0\x03\ + \x12\x04\x8a\x03\x16\x17\n\x0c\n\x02\x04\x17\x12\x06\x8d\x03\0\x9c\x03\ + \x01\n\x0b\n\x03\x04\x17\x01\x12\x04\x8d\x03\x08\x19\n\x1d\n\x04\x04\x17\ + \x02\0\x12\x04\x8f\x03\x08\x17\x1a\x0f\x20Allow\x20or\x20deny\n\n\x0f\n\ + \x05\x04\x17\x02\0\x04\x12\x06\x8f\x03\x08\x8d\x03\x1b\n\r\n\x05\x04\x17\ + \x02\0\x05\x12\x04\x8f\x03\x08\x0c\n\r\n\x05\x04\x17\x02\0\x01\x12\x04\ + \x8f\x03\r\x12\n\r\n\x05\x04\x17\x02\0\x03\x12\x04\x8f\x03\x15\x16\n.\n\ + \x04\x04\x17\x02\x01\x12\x04\x92\x03\x08\x18\x1a\x20\x20Device\x20type,\ + \x20block,\x20char,\x20etc.\n\n\x0f\n\x05\x04\x17\x02\x01\x04\x12\x06\ + \x92\x03\x08\x8f\x03\x17\n\r\n\x05\x04\x17\x02\x01\x05\x12\x04\x92\x03\ + \x08\x0e\n\r\n\x05\x04\x17\x02\x01\x01\x12\x04\x92\x03\x0f\x13\n\r\n\x05\ + \x04\x17\x02\x01\x03\x12\x04\x92\x03\x16\x17\n3\n\x04\x04\x17\x02\x02\ + \x12\x04\x95\x03\x08\x18\x1a%\x20Major\x20is\x20the\x20device's\x20major\ + \x20number.\n\n\x0f\n\x05\x04\x17\x02\x02\x04\x12\x06\x95\x03\x08\x92\ + \x03\x18\n\r\n\x05\x04\x17\x02\x02\x05\x12\x04\x95\x03\x08\r\n\r\n\x05\ + \x04\x17\x02\x02\x01\x12\x04\x95\x03\x0e\x13\n\r\n\x05\x04\x17\x02\x02\ + \x03\x12\x04\x95\x03\x16\x17\n3\n\x04\x04\x17\x02\x03\x12\x04\x98\x03\ + \x08\x18\x1a%\x20Minor\x20is\x20the\x20device's\x20minor\x20number.\n\n\ + \x0f\n\x05\x04\x17\x02\x03\x04\x12\x06\x98\x03\x08\x95\x03\x18\n\r\n\x05\ + \x04\x17\x02\x03\x05\x12\x04\x98\x03\x08\r\n\r\n\x05\x04\x17\x02\x03\x01\ + \x12\x04\x98\x03\x0e\x13\n\r\n\x05\x04\x17\x02\x03\x03\x12\x04\x98\x03\ + \x16\x17\n6\n\x04\x04\x17\x02\x04\x12\x04\x9b\x03\x08\x1a\x1a(\x20Cgroup\ + \x20access\x20permissions\x20format,\x20rwm.\n\n\x0f\n\x05\x04\x17\x02\ + \x04\x04\x12\x06\x9b\x03\x08\x98\x03\x18\n\r\n\x05\x04\x17\x02\x04\x05\ + \x12\x04\x9b\x03\x08\x0e\n\r\n\x05\x04\x17\x02\x04\x01\x12\x04\x9b\x03\ + \x0f\x15\n\r\n\x05\x04\x17\x02\x04\x03\x12\x04\x9b\x03\x18\x19\n\x0c\n\ + \x02\x04\x18\x12\x06\x9e\x03\0\xa4\x03\x01\n\x0b\n\x03\x04\x18\x01\x12\ + \x04\x9e\x03\x08\x14\nD\n\x04\x04\x18\x02\0\x12\x04\xa0\x03\x08\x1b\x1a6\ + \x20Set\x20class\x20identifier\x20for\x20container's\x20network\x20packe\ + ts\n\n\x0f\n\x05\x04\x18\x02\0\x04\x12\x06\xa0\x03\x08\x9e\x03\x16\n\r\n\ + \x05\x04\x18\x02\0\x05\x12\x04\xa0\x03\x08\x0e\n\r\n\x05\x04\x18\x02\0\ + \x01\x12\x04\xa0\x03\x0f\x16\n\r\n\x05\x04\x18\x02\0\x03\x12\x04\xa0\x03\ + \x19\x1a\n=\n\x04\x04\x18\x02\x01\x12\x04\xa3\x03\x08W\x1a/\x20Set\x20pr\ + iority\x20of\x20network\x20traffic\x20for\x20container\n\n\r\n\x05\x04\ + \x18\x02\x01\x04\x12\x04\xa3\x03\x08\x10\n\r\n\x05\x04\x18\x02\x01\x06\ + \x12\x04\xa3\x03\x11'\n\r\n\x05\x04\x18\x02\x01\x01\x12\x04\xa3\x03(2\n\ + \r\n\x05\x04\x18\x02\x01\x03\x12\x04\xa3\x0356\n\r\n\x05\x04\x18\x02\x01\ + \x08\x12\x04\xa3\x038V\n\x10\n\x08\x04\x18\x02\x01\x08\xe9\xfb\x03\x12\ + \x04\xa3\x039U\n\x0c\n\x02\x04\x19\x12\x06\xa6\x03\0\xac\x03\x01\n\x0b\n\ + \x03\x04\x19\x01\x12\x04\xa6\x03\x08\x1a\n-\n\x04\x04\x19\x02\0\x12\x04\ + \xa8\x03\x08\x1c\x1a\x1f\x20Pagesize\x20is\x20the\x20hugepage\x20size\n\ + \n\x0f\n\x05\x04\x19\x02\0\x04\x12\x06\xa8\x03\x08\xa6\x03\x1c\n\r\n\x05\ + \x04\x19\x02\0\x05\x12\x04\xa8\x03\x08\x0e\n\r\n\x05\x04\x19\x02\0\x01\ + \x12\x04\xa8\x03\x0f\x17\n\r\n\x05\x04\x19\x02\0\x03\x12\x04\xa8\x03\x1a\ + \x1b\nB\n\x04\x04\x19\x02\x01\x12\x04\xab\x03\x08\x19\x1a4\x20Limit\x20i\ + s\x20the\x20limit\x20of\x20\"hugepagesize\"\x20hugetlb\x20usage\n\n\x0f\ + \n\x05\x04\x19\x02\x01\x04\x12\x06\xab\x03\x08\xa8\x03\x1c\n\r\n\x05\x04\ + \x19\x02\x01\x05\x12\x04\xab\x03\x08\x0e\n\r\n\x05\x04\x19\x02\x01\x01\ + \x12\x04\xab\x03\x0f\x14\n\r\n\x05\x04\x19\x02\x01\x03\x12\x04\xab\x03\ + \x17\x18\n\x0c\n\x02\x04\x1a\x12\x06\xae\x03\0\xb4\x03\x01\n\x0b\n\x03\ + \x04\x1a\x01\x12\x04\xae\x03\x08\x1e\n9\n\x04\x04\x1a\x02\0\x12\x04\xb0\ + \x03\x08\x18\x1a+\x20Name\x20is\x20the\x20name\x20of\x20the\x20network\ + \x20interface\n\n\x0f\n\x05\x04\x1a\x02\0\x04\x12\x06\xb0\x03\x08\xae\ + \x03\x20\n\r\n\x05\x04\x1a\x02\0\x05\x12\x04\xb0\x03\x08\x0e\n\r\n\x05\ + \x04\x1a\x02\0\x01\x12\x04\xb0\x03\x0f\x13\n\r\n\x05\x04\x1a\x02\0\x03\ + \x12\x04\xb0\x03\x16\x17\n*\n\x04\x04\x1a\x02\x01\x12\x04\xb3\x03\x08\ + \x1c\x1a\x1c\x20Priority\x20for\x20the\x20interface\n\n\x0f\n\x05\x04\ + \x1a\x02\x01\x04\x12\x06\xb3\x03\x08\xb0\x03\x18\n\r\n\x05\x04\x1a\x02\ + \x01\x05\x12\x04\xb3\x03\x08\x0e\n\r\n\x05\x04\x1a\x02\x01\x01\x12\x04\ + \xb3\x03\x0f\x17\n\r\n\x05\x04\x1a\x02\x01\x03\x12\x04\xb3\x03\x1a\x1b\n\ + \x0c\n\x02\x04\x1b\x12\x06\xb6\x03\0\xba\x03\x01\n\x0b\n\x03\x04\x1b\x01\ + \x12\x04\xb6\x03\x08\x14\n\x0c\n\x04\x04\x1b\x02\0\x12\x04\xb7\x03\x08!\ + \n\x0f\n\x05\x04\x1b\x02\0\x04\x12\x06\xb7\x03\x08\xb6\x03\x16\n\r\n\x05\ + \x04\x1b\x02\0\x05\x12\x04\xb7\x03\x08\x0e\n\r\n\x05\x04\x1b\x02\0\x01\ + \x12\x04\xb7\x03\x0f\x1c\n\r\n\x05\x04\x1b\x02\0\x03\x12\x04\xb7\x03\x1f\ + \x20\n\x0c\n\x04\x04\x1b\x02\x01\x12\x04\xb8\x03\x08*\n\r\n\x05\x04\x1b\ + \x02\x01\x04\x12\x04\xb8\x03\x08\x10\n\r\n\x05\x04\x1b\x02\x01\x05\x12\ + \x04\xb8\x03\x11\x17\n\r\n\x05\x04\x1b\x02\x01\x01\x12\x04\xb8\x03\x18%\ + \n\r\n\x05\x04\x1b\x02\x01\x03\x12\x04\xb8\x03()\n\x0c\n\x04\x04\x1b\x02\ + \x02\x12\x04\xb9\x03\x08K\n\r\n\x05\x04\x1b\x02\x02\x04\x12\x04\xb9\x03\ + \x08\x10\n\r\n\x05\x04\x1b\x02\x02\x06\x12\x04\xb9\x03\x11\x1d\n\r\n\x05\ + \x04\x1b\x02\x02\x01\x12\x04\xb9\x03\x1e&\n\r\n\x05\x04\x1b\x02\x02\x03\ + \x12\x04\xb9\x03)*\n\r\n\x05\x04\x1b\x02\x02\x08\x12\x04\xb9\x03,J\n\x10\ + \n\x08\x04\x1b\x02\x02\x08\xe9\xfb\x03\x12\x04\xb9\x03-I\n\x0c\n\x02\x04\ + \x1c\x12\x06\xbc\x03\0\xc1\x03\x01\n\x0b\n\x03\x04\x1c\x01\x12\x04\xbc\ + \x03\x08\x17\n\x0c\n\x04\x04\x1c\x02\0\x12\x04\xbd\x03\x08\x19\n\x0f\n\ + \x05\x04\x1c\x02\0\x04\x12\x06\xbd\x03\x08\xbc\x03\x19\n\r\n\x05\x04\x1c\ + \x02\0\x05\x12\x04\xbd\x03\x08\x0e\n\r\n\x05\x04\x1c\x02\0\x01\x12\x04\ + \xbd\x03\x0f\x14\n\r\n\x05\x04\x1c\x02\0\x03\x12\x04\xbd\x03\x17\x18\n\ + \x0c\n\x04\x04\x1c\x02\x01\x12\x04\xbe\x03\x08\x19\n\x0f\n\x05\x04\x1c\ + \x02\x01\x04\x12\x06\xbe\x03\x08\xbd\x03\x19\n\r\n\x05\x04\x1c\x02\x01\ + \x05\x12\x04\xbe\x03\x08\x0e\n\r\n\x05\x04\x1c\x02\x01\x01\x12\x04\xbe\ + \x03\x0f\x14\n\r\n\x05\x04\x1c\x02\x01\x03\x12\x04\xbe\x03\x17\x18\n\x0c\ + \n\x04\x04\x1c\x02\x02\x12\x04\xbf\x03\x08\x1c\n\x0f\n\x05\x04\x1c\x02\ + \x02\x04\x12\x06\xbf\x03\x08\xbe\x03\x19\n\r\n\x05\x04\x1c\x02\x02\x05\ + \x12\x04\xbf\x03\x08\x0e\n\r\n\x05\x04\x1c\x02\x02\x01\x12\x04\xbf\x03\ + \x0f\x17\n\r\n\x05\x04\x1c\x02\x02\x03\x12\x04\xbf\x03\x1a\x1b\n\x0c\n\ + \x04\x04\x1c\x02\x03\x12\x04\xc0\x03\x08\x16\n\x0f\n\x05\x04\x1c\x02\x03\ + \x04\x12\x06\xc0\x03\x08\xbf\x03\x1c\n\r\n\x05\x04\x1c\x02\x03\x05\x12\ + \x04\xc0\x03\x08\x0e\n\r\n\x05\x04\x1c\x02\x03\x01\x12\x04\xc0\x03\x0f\ + \x11\n\r\n\x05\x04\x1c\x02\x03\x03\x12\x04\xc0\x03\x14\x15\n\x0c\n\x02\ + \x04\x1d\x12\x06\xc3\x03\0\xc7\x03\x01\n\x0b\n\x03\x04\x1d\x01\x12\x04\ + \xc3\x03\x08\x14\n\x0c\n\x04\x04\x1d\x02\0\x12\x04\xc4\x03\x08\"\n\r\n\ + \x05\x04\x1d\x02\0\x04\x12\x04\xc4\x03\x08\x10\n\r\n\x05\x04\x1d\x02\0\ + \x05\x12\x04\xc4\x03\x11\x17\n\r\n\x05\x04\x1d\x02\0\x01\x12\x04\xc4\x03\ + \x18\x1d\n\r\n\x05\x04\x1d\x02\0\x03\x12\x04\xc4\x03\x20!\n\x0c\n\x04\ + \x04\x1d\x02\x01\x12\x04\xc5\x03\x08\x1a\n\x0f\n\x05\x04\x1d\x02\x01\x04\ + \x12\x06\xc5\x03\x08\xc4\x03\"\n\r\n\x05\x04\x1d\x02\x01\x05\x12\x04\xc5\ + \x03\x08\x0e\n\r\n\x05\x04\x1d\x02\x01\x01\x12\x04\xc5\x03\x0f\x15\n\r\n\ + \x05\x04\x1d\x02\x01\x03\x12\x04\xc5\x03\x18\x19\n\x0c\n\x04\x04\x1d\x02\ + \x02\x12\x04\xc6\x03\x08J\n\r\n\x05\x04\x1d\x02\x02\x04\x12\x04\xc6\x03\ + \x08\x10\n\r\n\x05\x04\x1d\x02\x02\x06\x12\x04\xc6\x03\x11\x20\n\r\n\x05\ + \x04\x1d\x02\x02\x01\x12\x04\xc6\x03!%\n\r\n\x05\x04\x1d\x02\x02\x03\x12\ + \x04\xc6\x03()\n\r\n\x05\x04\x1d\x02\x02\x08\x12\x04\xc6\x03+I\n\x10\n\ + \x08\x04\x1d\x02\x02\x08\xe9\xfb\x03\x12\x04\xc6\x03,H\n\x0c\n\x02\x04\ + \x1e\x12\x06\xc9\x03\0\xcd\x03\x01\n\x0b\n\x03\x04\x1e\x01\x12\x04\xc9\ + \x03\x08\x15\n}\n\x04\x04\x1e\x02\0\x12\x04\xcc\x03\x08!\x1ao\x20The\x20\ + schema\x20for\x20L3\x20cache\x20id\x20and\x20capacity\x20bitmask\x20(CBM\ + )\n\x20Format:\x20\"L3:=;=;...\"\n\n\ + \x0f\n\x05\x04\x1e\x02\0\x04\x12\x06\xcc\x03\x08\xc9\x03\x17\n\r\n\x05\ + \x04\x1e\x02\0\x05\x12\x04\xcc\x03\x08\x0e\n\r\n\x05\x04\x1e\x02\0\x01\ + \x12\x04\xcc\x03\x0f\x1c\n\r\n\x05\x04\x1e\x02\0\x03\x12\x04\xcc\x03\x1f\ + \x20b\x06proto3\ +"; + +static mut file_descriptor_proto_lazy: ::protobuf::lazy::Lazy<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::descriptor::FileDescriptorProto, +}; + +fn parse_descriptor_proto() -> ::protobuf::descriptor::FileDescriptorProto { + ::protobuf::parse_from_bytes(file_descriptor_proto_data).unwrap() +} + +pub fn file_descriptor_proto() -> &'static ::protobuf::descriptor::FileDescriptorProto { + unsafe { + file_descriptor_proto_lazy.get(|| { + parse_descriptor_proto() + }) + } +} diff --git a/src/agent/protocols/src/types.rs b/src/agent/protocols/src/types.rs new file mode 100644 index 0000000000..9df4cb46c8 --- /dev/null +++ b/src/agent/protocols/src/types.rs @@ -0,0 +1,1217 @@ +// This file is generated by rust-protobuf 2.6.2. Do not edit +// @generated + +// https://github.com/Manishearth/rust-clippy/issues/702 +#![allow(unknown_lints)] +#![allow(clippy)] + +#![cfg_attr(rustfmt, rustfmt_skip)] + +#![allow(box_pointers)] +#![allow(dead_code)] +#![allow(missing_docs)] +#![allow(non_camel_case_types)] +#![allow(non_snake_case)] +#![allow(non_upper_case_globals)] +#![allow(trivial_casts)] +#![allow(unsafe_code)] +#![allow(unused_imports)] +#![allow(unused_results)] + +use protobuf::Message as Message_imported_for_functions; +use protobuf::ProtobufEnum as ProtobufEnum_imported_for_functions; + +#[derive(PartialEq,Clone,Default)] +pub struct IPAddress { + // message fields + pub family: IPFamily, + pub address: ::std::string::String, + pub mask: ::std::string::String, + // special fields + pub unknown_fields: ::protobuf::UnknownFields, + pub cached_size: ::protobuf::CachedSize, +} + +impl<'a> ::std::default::Default for &'a IPAddress { + fn default() -> &'a IPAddress { + ::default_instance() + } +} + +impl IPAddress { + pub fn new() -> IPAddress { + ::std::default::Default::default() + } + + // .types.IPFamily family = 1; + + + pub fn get_family(&self) -> IPFamily { + self.family + } + pub fn clear_family(&mut self) { + self.family = IPFamily::v4; + } + + // Param is passed by value, moved + pub fn set_family(&mut self, v: IPFamily) { + self.family = v; + } + + // string address = 2; + + + pub fn get_address(&self) -> &str { + &self.address + } + pub fn clear_address(&mut self) { + self.address.clear(); + } + + // Param is passed by value, moved + pub fn set_address(&mut self, v: ::std::string::String) { + self.address = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_address(&mut self) -> &mut ::std::string::String { + &mut self.address + } + + // Take field + pub fn take_address(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.address, ::std::string::String::new()) + } + + // string mask = 3; + + + pub fn get_mask(&self) -> &str { + &self.mask + } + pub fn clear_mask(&mut self) { + self.mask.clear(); + } + + // Param is passed by value, moved + pub fn set_mask(&mut self, v: ::std::string::String) { + self.mask = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_mask(&mut self) -> &mut ::std::string::String { + &mut self.mask + } + + // Take field + pub fn take_mask(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.mask, ::std::string::String::new()) + } +} + +impl ::protobuf::Message for IPAddress { + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_proto3_enum_with_unknown_fields_into(wire_type, is, &mut self.family, 1, &mut self.unknown_fields)? + }, + 2 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.address)?; + }, + 3 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.mask)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if self.family != IPFamily::v4 { + my_size += ::protobuf::rt::enum_size(1, self.family); + } + if !self.address.is_empty() { + my_size += ::protobuf::rt::string_size(2, &self.address); + } + if !self.mask.is_empty() { + my_size += ::protobuf::rt::string_size(3, &self.mask); + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if self.family != IPFamily::v4 { + os.write_enum(1, self.family.value())?; + } + if !self.address.is_empty() { + os.write_string(2, &self.address)?; + } + if !self.mask.is_empty() { + os.write_string(3, &self.mask)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> IPAddress { + IPAddress::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeEnum>( + "family", + |m: &IPAddress| { &m.family }, + |m: &mut IPAddress| { &mut m.family }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "address", + |m: &IPAddress| { &m.address }, + |m: &mut IPAddress| { &mut m.address }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "mask", + |m: &IPAddress| { &m.mask }, + |m: &mut IPAddress| { &mut m.mask }, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "IPAddress", + fields, + file_descriptor_proto() + ) + }) + } + } + + fn default_instance() -> &'static IPAddress { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const IPAddress, + }; + unsafe { + instance.get(IPAddress::new) + } + } +} + +impl ::protobuf::Clear for IPAddress { + fn clear(&mut self) { + self.family = IPFamily::v4; + self.address.clear(); + self.mask.clear(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for IPAddress { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for IPAddress { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct Interface { + // message fields + pub device: ::std::string::String, + pub name: ::std::string::String, + pub IPAddresses: ::protobuf::RepeatedField, + pub mtu: u64, + pub hwAddr: ::std::string::String, + pub pciAddr: ::std::string::String, + pub field_type: ::std::string::String, + pub raw_flags: u32, + // special fields + pub unknown_fields: ::protobuf::UnknownFields, + pub cached_size: ::protobuf::CachedSize, +} + +impl<'a> ::std::default::Default for &'a Interface { + fn default() -> &'a Interface { + ::default_instance() + } +} + +impl Interface { + pub fn new() -> Interface { + ::std::default::Default::default() + } + + // string device = 1; + + + pub fn get_device(&self) -> &str { + &self.device + } + pub fn clear_device(&mut self) { + self.device.clear(); + } + + // Param is passed by value, moved + pub fn set_device(&mut self, v: ::std::string::String) { + self.device = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_device(&mut self) -> &mut ::std::string::String { + &mut self.device + } + + // Take field + pub fn take_device(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.device, ::std::string::String::new()) + } + + // string name = 2; + + + pub fn get_name(&self) -> &str { + &self.name + } + pub fn clear_name(&mut self) { + self.name.clear(); + } + + // Param is passed by value, moved + pub fn set_name(&mut self, v: ::std::string::String) { + self.name = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_name(&mut self) -> &mut ::std::string::String { + &mut self.name + } + + // Take field + pub fn take_name(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.name, ::std::string::String::new()) + } + + // repeated .types.IPAddress IPAddresses = 3; + + + pub fn get_IPAddresses(&self) -> &[IPAddress] { + &self.IPAddresses + } + pub fn clear_IPAddresses(&mut self) { + self.IPAddresses.clear(); + } + + // Param is passed by value, moved + pub fn set_IPAddresses(&mut self, v: ::protobuf::RepeatedField) { + self.IPAddresses = v; + } + + // Mutable pointer to the field. + pub fn mut_IPAddresses(&mut self) -> &mut ::protobuf::RepeatedField { + &mut self.IPAddresses + } + + // Take field + pub fn take_IPAddresses(&mut self) -> ::protobuf::RepeatedField { + ::std::mem::replace(&mut self.IPAddresses, ::protobuf::RepeatedField::new()) + } + + // uint64 mtu = 4; + + + pub fn get_mtu(&self) -> u64 { + self.mtu + } + pub fn clear_mtu(&mut self) { + self.mtu = 0; + } + + // Param is passed by value, moved + pub fn set_mtu(&mut self, v: u64) { + self.mtu = v; + } + + // string hwAddr = 5; + + + pub fn get_hwAddr(&self) -> &str { + &self.hwAddr + } + pub fn clear_hwAddr(&mut self) { + self.hwAddr.clear(); + } + + // Param is passed by value, moved + pub fn set_hwAddr(&mut self, v: ::std::string::String) { + self.hwAddr = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_hwAddr(&mut self) -> &mut ::std::string::String { + &mut self.hwAddr + } + + // Take field + pub fn take_hwAddr(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.hwAddr, ::std::string::String::new()) + } + + // string pciAddr = 6; + + + pub fn get_pciAddr(&self) -> &str { + &self.pciAddr + } + pub fn clear_pciAddr(&mut self) { + self.pciAddr.clear(); + } + + // Param is passed by value, moved + pub fn set_pciAddr(&mut self, v: ::std::string::String) { + self.pciAddr = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_pciAddr(&mut self) -> &mut ::std::string::String { + &mut self.pciAddr + } + + // Take field + pub fn take_pciAddr(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.pciAddr, ::std::string::String::new()) + } + + // string type = 7; + + + pub fn get_field_type(&self) -> &str { + &self.field_type + } + pub fn clear_field_type(&mut self) { + self.field_type.clear(); + } + + // Param is passed by value, moved + pub fn set_field_type(&mut self, v: ::std::string::String) { + self.field_type = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_field_type(&mut self) -> &mut ::std::string::String { + &mut self.field_type + } + + // Take field + pub fn take_field_type(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.field_type, ::std::string::String::new()) + } + + // uint32 raw_flags = 8; + + + pub fn get_raw_flags(&self) -> u32 { + self.raw_flags + } + pub fn clear_raw_flags(&mut self) { + self.raw_flags = 0; + } + + // Param is passed by value, moved + pub fn set_raw_flags(&mut self, v: u32) { + self.raw_flags = v; + } +} + +impl ::protobuf::Message for Interface { + fn is_initialized(&self) -> bool { + for v in &self.IPAddresses { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.device)?; + }, + 2 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.name)?; + }, + 3 => { + ::protobuf::rt::read_repeated_message_into(wire_type, is, &mut self.IPAddresses)?; + }, + 4 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint64()?; + self.mtu = tmp; + }, + 5 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.hwAddr)?; + }, + 6 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.pciAddr)?; + }, + 7 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.field_type)?; + }, + 8 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint32()?; + self.raw_flags = tmp; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if !self.device.is_empty() { + my_size += ::protobuf::rt::string_size(1, &self.device); + } + if !self.name.is_empty() { + my_size += ::protobuf::rt::string_size(2, &self.name); + } + for value in &self.IPAddresses { + let len = value.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + }; + if self.mtu != 0 { + my_size += ::protobuf::rt::value_size(4, self.mtu, ::protobuf::wire_format::WireTypeVarint); + } + if !self.hwAddr.is_empty() { + my_size += ::protobuf::rt::string_size(5, &self.hwAddr); + } + if !self.pciAddr.is_empty() { + my_size += ::protobuf::rt::string_size(6, &self.pciAddr); + } + if !self.field_type.is_empty() { + my_size += ::protobuf::rt::string_size(7, &self.field_type); + } + if self.raw_flags != 0 { + my_size += ::protobuf::rt::value_size(8, self.raw_flags, ::protobuf::wire_format::WireTypeVarint); + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if !self.device.is_empty() { + os.write_string(1, &self.device)?; + } + if !self.name.is_empty() { + os.write_string(2, &self.name)?; + } + for v in &self.IPAddresses { + os.write_tag(3, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + }; + if self.mtu != 0 { + os.write_uint64(4, self.mtu)?; + } + if !self.hwAddr.is_empty() { + os.write_string(5, &self.hwAddr)?; + } + if !self.pciAddr.is_empty() { + os.write_string(6, &self.pciAddr)?; + } + if !self.field_type.is_empty() { + os.write_string(7, &self.field_type)?; + } + if self.raw_flags != 0 { + os.write_uint32(8, self.raw_flags)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> Interface { + Interface::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "device", + |m: &Interface| { &m.device }, + |m: &mut Interface| { &mut m.device }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "name", + |m: &Interface| { &m.name }, + |m: &mut Interface| { &mut m.name }, + )); + fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "IPAddresses", + |m: &Interface| { &m.IPAddresses }, + |m: &mut Interface| { &mut m.IPAddresses }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( + "mtu", + |m: &Interface| { &m.mtu }, + |m: &mut Interface| { &mut m.mtu }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "hwAddr", + |m: &Interface| { &m.hwAddr }, + |m: &mut Interface| { &mut m.hwAddr }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "pciAddr", + |m: &Interface| { &m.pciAddr }, + |m: &mut Interface| { &mut m.pciAddr }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "type", + |m: &Interface| { &m.field_type }, + |m: &mut Interface| { &mut m.field_type }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint32>( + "raw_flags", + |m: &Interface| { &m.raw_flags }, + |m: &mut Interface| { &mut m.raw_flags }, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "Interface", + fields, + file_descriptor_proto() + ) + }) + } + } + + fn default_instance() -> &'static Interface { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const Interface, + }; + unsafe { + instance.get(Interface::new) + } + } +} + +impl ::protobuf::Clear for Interface { + fn clear(&mut self) { + self.device.clear(); + self.name.clear(); + self.IPAddresses.clear(); + self.mtu = 0; + self.hwAddr.clear(); + self.pciAddr.clear(); + self.field_type.clear(); + self.raw_flags = 0; + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for Interface { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for Interface { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct Route { + // message fields + pub dest: ::std::string::String, + pub gateway: ::std::string::String, + pub device: ::std::string::String, + pub source: ::std::string::String, + pub scope: u32, + // special fields + pub unknown_fields: ::protobuf::UnknownFields, + pub cached_size: ::protobuf::CachedSize, +} + +impl<'a> ::std::default::Default for &'a Route { + fn default() -> &'a Route { + ::default_instance() + } +} + +impl Route { + pub fn new() -> Route { + ::std::default::Default::default() + } + + // string dest = 1; + + + pub fn get_dest(&self) -> &str { + &self.dest + } + pub fn clear_dest(&mut self) { + self.dest.clear(); + } + + // Param is passed by value, moved + pub fn set_dest(&mut self, v: ::std::string::String) { + self.dest = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_dest(&mut self) -> &mut ::std::string::String { + &mut self.dest + } + + // Take field + pub fn take_dest(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.dest, ::std::string::String::new()) + } + + // string gateway = 2; + + + pub fn get_gateway(&self) -> &str { + &self.gateway + } + pub fn clear_gateway(&mut self) { + self.gateway.clear(); + } + + // Param is passed by value, moved + pub fn set_gateway(&mut self, v: ::std::string::String) { + self.gateway = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_gateway(&mut self) -> &mut ::std::string::String { + &mut self.gateway + } + + // Take field + pub fn take_gateway(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.gateway, ::std::string::String::new()) + } + + // string device = 3; + + + pub fn get_device(&self) -> &str { + &self.device + } + pub fn clear_device(&mut self) { + self.device.clear(); + } + + // Param is passed by value, moved + pub fn set_device(&mut self, v: ::std::string::String) { + self.device = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_device(&mut self) -> &mut ::std::string::String { + &mut self.device + } + + // Take field + pub fn take_device(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.device, ::std::string::String::new()) + } + + // string source = 4; + + + pub fn get_source(&self) -> &str { + &self.source + } + pub fn clear_source(&mut self) { + self.source.clear(); + } + + // Param is passed by value, moved + pub fn set_source(&mut self, v: ::std::string::String) { + self.source = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_source(&mut self) -> &mut ::std::string::String { + &mut self.source + } + + // Take field + pub fn take_source(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.source, ::std::string::String::new()) + } + + // uint32 scope = 5; + + + pub fn get_scope(&self) -> u32 { + self.scope + } + pub fn clear_scope(&mut self) { + self.scope = 0; + } + + // Param is passed by value, moved + pub fn set_scope(&mut self, v: u32) { + self.scope = v; + } +} + +impl ::protobuf::Message for Route { + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.dest)?; + }, + 2 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.gateway)?; + }, + 3 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.device)?; + }, + 4 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.source)?; + }, + 5 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint32()?; + self.scope = tmp; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if !self.dest.is_empty() { + my_size += ::protobuf::rt::string_size(1, &self.dest); + } + if !self.gateway.is_empty() { + my_size += ::protobuf::rt::string_size(2, &self.gateway); + } + if !self.device.is_empty() { + my_size += ::protobuf::rt::string_size(3, &self.device); + } + if !self.source.is_empty() { + my_size += ::protobuf::rt::string_size(4, &self.source); + } + if self.scope != 0 { + my_size += ::protobuf::rt::value_size(5, self.scope, ::protobuf::wire_format::WireTypeVarint); + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if !self.dest.is_empty() { + os.write_string(1, &self.dest)?; + } + if !self.gateway.is_empty() { + os.write_string(2, &self.gateway)?; + } + if !self.device.is_empty() { + os.write_string(3, &self.device)?; + } + if !self.source.is_empty() { + os.write_string(4, &self.source)?; + } + if self.scope != 0 { + os.write_uint32(5, self.scope)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> Route { + Route::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "dest", + |m: &Route| { &m.dest }, + |m: &mut Route| { &mut m.dest }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "gateway", + |m: &Route| { &m.gateway }, + |m: &mut Route| { &mut m.gateway }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "device", + |m: &Route| { &m.device }, + |m: &mut Route| { &mut m.device }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "source", + |m: &Route| { &m.source }, + |m: &mut Route| { &mut m.source }, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint32>( + "scope", + |m: &Route| { &m.scope }, + |m: &mut Route| { &mut m.scope }, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "Route", + fields, + file_descriptor_proto() + ) + }) + } + } + + fn default_instance() -> &'static Route { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const Route, + }; + unsafe { + instance.get(Route::new) + } + } +} + +impl ::protobuf::Clear for Route { + fn clear(&mut self) { + self.dest.clear(); + self.gateway.clear(); + self.device.clear(); + self.source.clear(); + self.scope = 0; + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for Route { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for Route { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(Clone,PartialEq,Eq,Debug,Hash)] +pub enum IPFamily { + v4 = 0, + v6 = 1, +} + +impl ::protobuf::ProtobufEnum for IPFamily { + fn value(&self) -> i32 { + *self as i32 + } + + fn from_i32(value: i32) -> ::std::option::Option { + match value { + 0 => ::std::option::Option::Some(IPFamily::v4), + 1 => ::std::option::Option::Some(IPFamily::v6), + _ => ::std::option::Option::None + } + } + + fn values() -> &'static [Self] { + static values: &'static [IPFamily] = &[ + IPFamily::v4, + IPFamily::v6, + ]; + values + } + + fn enum_descriptor_static() -> &'static ::protobuf::reflect::EnumDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::EnumDescriptor, + }; + unsafe { + descriptor.get(|| { + ::protobuf::reflect::EnumDescriptor::new("IPFamily", file_descriptor_proto()) + }) + } + } +} + +impl ::std::marker::Copy for IPFamily { +} + +impl ::std::default::Default for IPFamily { + fn default() -> Self { + IPFamily::v4 + } +} + +impl ::protobuf::reflect::ProtobufValue for IPFamily { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Enum(self.descriptor()) + } +} + +static file_descriptor_proto_data: &'static [u8] = b"\ + \n6github.com/kata-containers/agent/pkg/types/types.proto\x12\x05types\"\ + b\n\tIPAddress\x12'\n\x06family\x18\x01\x20\x01(\x0e2\x0f.types.IPFamily\ + R\x06family\x12\x18\n\x07address\x18\x02\x20\x01(\tR\x07address\x12\x12\ + \n\x04mask\x18\x03\x20\x01(\tR\x04mask\"\xe0\x01\n\tInterface\x12\x16\n\ + \x06device\x18\x01\x20\x01(\tR\x06device\x12\x12\n\x04name\x18\x02\x20\ + \x01(\tR\x04name\x122\n\x0bIPAddresses\x18\x03\x20\x03(\x0b2\x10.types.I\ + PAddressR\x0bIPAddresses\x12\x10\n\x03mtu\x18\x04\x20\x01(\x04R\x03mtu\ + \x12\x16\n\x06hwAddr\x18\x05\x20\x01(\tR\x06hwAddr\x12\x18\n\x07pciAddr\ + \x18\x06\x20\x01(\tR\x07pciAddr\x12\x12\n\x04type\x18\x07\x20\x01(\tR\ + \x04type\x12\x1b\n\traw_flags\x18\x08\x20\x01(\rR\x08rawFlags\"{\n\x05Ro\ + ute\x12\x12\n\x04dest\x18\x01\x20\x01(\tR\x04dest\x12\x18\n\x07gateway\ + \x18\x02\x20\x01(\tR\x07gateway\x12\x16\n\x06device\x18\x03\x20\x01(\tR\ + \x06device\x12\x16\n\x06source\x18\x04\x20\x01(\tR\x06source\x12\x14\n\ + \x05scope\x18\x05\x20\x01(\rR\x05scope*\x1a\n\x08IPFamily\x12\x06\n\x02v\ + 4\x10\0\x12\x06\n\x02v6\x10\x01J\xea\x0e\n\x06\x12\x04\x06\0/\x01\nU\n\ + \x01\x0c\x12\x03\x06\0\x122K\n\x20Copyright\x202018\x20Intel\x20Corporat\ + ion.\n\n\x20SPDX-License-Identifier:\x20Apache-2.0\n\n\n\x08\n\x01\x02\ + \x12\x03\x08\0\x0e\n\n\n\x02\x05\0\x12\x04\n\0\r\x01\n\n\n\x03\x05\0\x01\ + \x12\x03\n\x05\r\n\x0b\n\x04\x05\0\x02\0\x12\x03\x0b\x08\x0f\n\x0c\n\x05\ + \x05\0\x02\0\x01\x12\x03\x0b\x08\n\n\x0c\n\x05\x05\0\x02\0\x02\x12\x03\ + \x0b\r\x0e\n\x0b\n\x04\x05\0\x02\x01\x12\x03\x0c\x08\x0f\n\x0c\n\x05\x05\ + \0\x02\x01\x01\x12\x03\x0c\x08\n\n\x0c\n\x05\x05\0\x02\x01\x02\x12\x03\ + \x0c\r\x0e\n\n\n\x02\x04\0\x12\x04\x0f\0\x13\x01\n\n\n\x03\x04\0\x01\x12\ + \x03\x0f\x08\x11\n\x0b\n\x04\x04\0\x02\0\x12\x03\x10\x08\x1c\n\r\n\x05\ + \x04\0\x02\0\x04\x12\x04\x10\x08\x0f\x13\n\x0c\n\x05\x04\0\x02\0\x06\x12\ + \x03\x10\x08\x10\n\x0c\n\x05\x04\0\x02\0\x01\x12\x03\x10\x11\x17\n\x0c\n\ + \x05\x04\0\x02\0\x03\x12\x03\x10\x1a\x1b\n\x0b\n\x04\x04\0\x02\x01\x12\ + \x03\x11\x08\x1b\n\r\n\x05\x04\0\x02\x01\x04\x12\x04\x11\x08\x10\x1c\n\ + \x0c\n\x05\x04\0\x02\x01\x05\x12\x03\x11\x08\x0e\n\x0c\n\x05\x04\0\x02\ + \x01\x01\x12\x03\x11\x0f\x16\n\x0c\n\x05\x04\0\x02\x01\x03\x12\x03\x11\ + \x19\x1a\n\x0b\n\x04\x04\0\x02\x02\x12\x03\x12\x08\x18\n\r\n\x05\x04\0\ + \x02\x02\x04\x12\x04\x12\x08\x11\x1b\n\x0c\n\x05\x04\0\x02\x02\x05\x12\ + \x03\x12\x08\x0e\n\x0c\n\x05\x04\0\x02\x02\x01\x12\x03\x12\x0f\x13\n\x0c\ + \n\x05\x04\0\x02\x02\x03\x12\x03\x12\x16\x17\n\n\n\x02\x04\x01\x12\x04\ + \x15\0'\x01\n\n\n\x03\x04\x01\x01\x12\x03\x15\x08\x11\n\x0b\n\x04\x04\ + \x01\x02\0\x12\x03\x16\x08\x1a\n\r\n\x05\x04\x01\x02\0\x04\x12\x04\x16\ + \x08\x15\x13\n\x0c\n\x05\x04\x01\x02\0\x05\x12\x03\x16\x08\x0e\n\x0c\n\ + \x05\x04\x01\x02\0\x01\x12\x03\x16\x0f\x15\n\x0c\n\x05\x04\x01\x02\0\x03\ + \x12\x03\x16\x18\x19\n\x0b\n\x04\x04\x01\x02\x01\x12\x03\x17\x08\x18\n\r\ + \n\x05\x04\x01\x02\x01\x04\x12\x04\x17\x08\x16\x1a\n\x0c\n\x05\x04\x01\ + \x02\x01\x05\x12\x03\x17\x08\x0e\n\x0c\n\x05\x04\x01\x02\x01\x01\x12\x03\ + \x17\x0f\x13\n\x0c\n\x05\x04\x01\x02\x01\x03\x12\x03\x17\x16\x17\n\x0b\n\ + \x04\x04\x01\x02\x02\x12\x03\x18\x08+\n\x0c\n\x05\x04\x01\x02\x02\x04\ + \x12\x03\x18\x08\x10\n\x0c\n\x05\x04\x01\x02\x02\x06\x12\x03\x18\x11\x1a\ + \n\x0c\n\x05\x04\x01\x02\x02\x01\x12\x03\x18\x1b&\n\x0c\n\x05\x04\x01\ + \x02\x02\x03\x12\x03\x18)*\n\x0b\n\x04\x04\x01\x02\x03\x12\x03\x19\x08\ + \x17\n\r\n\x05\x04\x01\x02\x03\x04\x12\x04\x19\x08\x18+\n\x0c\n\x05\x04\ + \x01\x02\x03\x05\x12\x03\x19\x08\x0e\n\x0c\n\x05\x04\x01\x02\x03\x01\x12\ + \x03\x19\x0f\x12\n\x0c\n\x05\x04\x01\x02\x03\x03\x12\x03\x19\x15\x16\n\ + \x0b\n\x04\x04\x01\x02\x04\x12\x03\x1a\x08\x1a\n\r\n\x05\x04\x01\x02\x04\ + \x04\x12\x04\x1a\x08\x19\x17\n\x0c\n\x05\x04\x01\x02\x04\x05\x12\x03\x1a\ + \x08\x0e\n\x0c\n\x05\x04\x01\x02\x04\x01\x12\x03\x1a\x0f\x15\n\x0c\n\x05\ + \x04\x01\x02\x04\x03\x12\x03\x1a\x18\x19\n\xfc\x01\n\x04\x04\x01\x02\x05\ + \x12\x03\x1f\x08\x1b\x1a\xee\x01\x20pciAddr\x20is\x20the\x20PCI\x20addre\ + ss\x20in\x20the\x20format\x20\x20\"bridgeAddr/deviceAddr\".\n\x20Here,\ + \x20bridgeAddr\x20is\x20the\x20address\x20at\x20which\x20the\x20bridge\ + \x20is\x20attached\x20on\x20the\x20root\x20bus,\n\x20while\x20deviceAddr\ + \x20is\x20the\x20address\x20at\x20which\x20the\x20network\x20device\x20i\ + s\x20attached\x20on\x20the\x20bridge.\n\n\r\n\x05\x04\x01\x02\x05\x04\ + \x12\x04\x1f\x08\x1a\x1a\n\x0c\n\x05\x04\x01\x02\x05\x05\x12\x03\x1f\x08\ + \x0e\n\x0c\n\x05\x04\x01\x02\x05\x01\x12\x03\x1f\x0f\x16\n\x0c\n\x05\x04\ + \x01\x02\x05\x03\x12\x03\x1f\x19\x1a\n\x88\x02\n\x04\x04\x01\x02\x06\x12\ + \x03%\x08\x18\x1a\xfa\x01\x20Type\x20defines\x20the\x20type\x20of\x20int\ + erface\x20described\x20by\x20this\x20structure.\n\x20The\x20expected\x20\ + values\x20are\x20the\x20one\x20that\x20are\x20defined\x20by\x20the\x20ne\ + tlink\n\x20library,\x20regarding\x20each\x20type\x20of\x20link.\x20Here\ + \x20is\x20a\x20non\x20exhaustive\n\x20list:\x20\"veth\",\x20\"macvtap\",\ + \x20\"vlan\",\x20\"macvlan\",\x20\"tap\",\x20...\n\n\r\n\x05\x04\x01\x02\ + \x06\x04\x12\x04%\x08\x1f\x1b\n\x0c\n\x05\x04\x01\x02\x06\x05\x12\x03%\ + \x08\x0e\n\x0c\n\x05\x04\x01\x02\x06\x01\x12\x03%\x0f\x13\n\x0c\n\x05\ + \x04\x01\x02\x06\x03\x12\x03%\x16\x17\n\x0b\n\x04\x04\x01\x02\x07\x12\ + \x03&\x08\x1d\n\r\n\x05\x04\x01\x02\x07\x04\x12\x04&\x08%\x18\n\x0c\n\ + \x05\x04\x01\x02\x07\x05\x12\x03&\x08\x0e\n\x0c\n\x05\x04\x01\x02\x07\ + \x01\x12\x03&\x0f\x18\n\x0c\n\x05\x04\x01\x02\x07\x03\x12\x03&\x1b\x1c\n\ + \n\n\x02\x04\x02\x12\x04)\0/\x01\n\n\n\x03\x04\x02\x01\x12\x03)\x08\r\n\ + \x0b\n\x04\x04\x02\x02\0\x12\x03*\x08\x18\n\r\n\x05\x04\x02\x02\0\x04\ + \x12\x04*\x08)\x0f\n\x0c\n\x05\x04\x02\x02\0\x05\x12\x03*\x08\x0e\n\x0c\ + \n\x05\x04\x02\x02\0\x01\x12\x03*\x0f\x13\n\x0c\n\x05\x04\x02\x02\0\x03\ + \x12\x03*\x16\x17\n\x0b\n\x04\x04\x02\x02\x01\x12\x03+\x08\x1b\n\r\n\x05\ + \x04\x02\x02\x01\x04\x12\x04+\x08*\x18\n\x0c\n\x05\x04\x02\x02\x01\x05\ + \x12\x03+\x08\x0e\n\x0c\n\x05\x04\x02\x02\x01\x01\x12\x03+\x0f\x16\n\x0c\ + \n\x05\x04\x02\x02\x01\x03\x12\x03+\x19\x1a\n\x0b\n\x04\x04\x02\x02\x02\ + \x12\x03,\x08\x1a\n\r\n\x05\x04\x02\x02\x02\x04\x12\x04,\x08+\x1b\n\x0c\ + \n\x05\x04\x02\x02\x02\x05\x12\x03,\x08\x0e\n\x0c\n\x05\x04\x02\x02\x02\ + \x01\x12\x03,\x0f\x15\n\x0c\n\x05\x04\x02\x02\x02\x03\x12\x03,\x18\x19\n\ + \x0b\n\x04\x04\x02\x02\x03\x12\x03-\x08\x1a\n\r\n\x05\x04\x02\x02\x03\ + \x04\x12\x04-\x08,\x1a\n\x0c\n\x05\x04\x02\x02\x03\x05\x12\x03-\x08\x0e\ + \n\x0c\n\x05\x04\x02\x02\x03\x01\x12\x03-\x0f\x15\n\x0c\n\x05\x04\x02\ + \x02\x03\x03\x12\x03-\x18\x19\n\x0b\n\x04\x04\x02\x02\x04\x12\x03.\x08\ + \x19\n\r\n\x05\x04\x02\x02\x04\x04\x12\x04.\x08-\x1a\n\x0c\n\x05\x04\x02\ + \x02\x04\x05\x12\x03.\x08\x0e\n\x0c\n\x05\x04\x02\x02\x04\x01\x12\x03.\ + \x0f\x14\n\x0c\n\x05\x04\x02\x02\x04\x03\x12\x03.\x17\x18b\x06proto3\ +"; + +static mut file_descriptor_proto_lazy: ::protobuf::lazy::Lazy<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::descriptor::FileDescriptorProto, +}; + +fn parse_descriptor_proto() -> ::protobuf::descriptor::FileDescriptorProto { + ::protobuf::parse_from_bytes(file_descriptor_proto_data).unwrap() +} + +pub fn file_descriptor_proto() -> &'static ::protobuf::descriptor::FileDescriptorProto { + unsafe { + file_descriptor_proto_lazy.get(|| { + parse_descriptor_proto() + }) + } +} diff --git a/src/agent/rustjail/Cargo.toml b/src/agent/rustjail/Cargo.toml new file mode 100644 index 0000000000..6fdcde2fb7 --- /dev/null +++ b/src/agent/rustjail/Cargo.toml @@ -0,0 +1,25 @@ +[package] +name = "rustjail" +version = "0.1.0" +authors = ["Yang Bo "] +edition = "2018" + +[dependencies] +error-chain = "0.12.1" +serde = "1.0.91" +serde_json = "1.0.39" +serde_derive = "1.0.91" +oci = { path = "../oci" } +protocols = { path ="../protocols" } +caps = "0.3.0" +nix = "0.14.1" +scopeguard = "1.0.0" +prctl = "1.0.0" +lazy_static = "1.3.0" +libc = "0.2.58" +protobuf = "2.6.1" +slog = "2.5.2" +slog-scope = "4.1.2" +scan_fmt = "0.2" +regex = "1.1" +path-absolutize = { git = "git://github.com/magiclen/path-absolutize.git", tag= "v1.1.3" } diff --git a/src/agent/rustjail/src/capabilities.rs b/src/agent/rustjail/src/capabilities.rs new file mode 100644 index 0000000000..7d7f066d85 --- /dev/null +++ b/src/agent/rustjail/src/capabilities.rs @@ -0,0 +1,135 @@ +// Copyright (c) 2019 Ant Financial +// +// SPDX-License-Identifier: Apache-2.0 +// + +// looks like we can use caps to manipulate capabilities +// conveniently, use caps to do it directly.. maybe + +use lazy_static; + +use crate::errors::*; +use caps::{self, CapSet, Capability, CapsHashSet}; +use protocols::oci::LinuxCapabilities; +use slog::Logger; +use std::collections::HashMap; + +lazy_static! { + pub static ref CAPSMAP: HashMap = { + let mut m = HashMap::new(); + m.insert("CAP_CHOWN".to_string(), Capability::CAP_CHOWN); + m.insert("CAP_DAC_OVERRIDE".to_string(), Capability::CAP_DAC_OVERRIDE); + m.insert( + "CAP_DAC_READ_SEARCH".to_string(), + Capability::CAP_DAC_READ_SEARCH, + ); + m.insert("CAP_FOWNER".to_string(), Capability::CAP_FOWNER); + m.insert("CAP_FSETID".to_string(), Capability::CAP_FSETID); + m.insert("CAP_KILL".to_string(), Capability::CAP_KILL); + m.insert("CAP_SETGID".to_string(), Capability::CAP_SETGID); + m.insert("CAP_SETUID".to_string(), Capability::CAP_SETUID); + m.insert("CAP_SETPCAP".to_string(), Capability::CAP_SETPCAP); + m.insert( + "CAP_LINUX_IMMUTABLE".to_string(), + Capability::CAP_LINUX_IMMUTABLE, + ); + m.insert( + "CAP_NET_BIND_SERVICE".to_string(), + Capability::CAP_NET_BIND_SERVICE, + ); + m.insert( + "CAP_NET_BROADCAST".to_string(), + Capability::CAP_NET_BROADCAST, + ); + m.insert("CAP_NET_ADMIN".to_string(), Capability::CAP_NET_ADMIN); + m.insert("CAP_NET_RAW".to_string(), Capability::CAP_NET_RAW); + m.insert("CAP_IPC_LOCK".to_string(), Capability::CAP_IPC_LOCK); + m.insert("CAP_IPC_OWNER".to_string(), Capability::CAP_IPC_OWNER); + m.insert("CAP_SYS_MODULE".to_string(), Capability::CAP_SYS_MODULE); + m.insert("CAP_SYS_RAWIO".to_string(), Capability::CAP_SYS_RAWIO); + m.insert("CAP_SYS_CHROOT".to_string(), Capability::CAP_SYS_CHROOT); + m.insert("CAP_SYS_PTRACE".to_string(), Capability::CAP_SYS_PTRACE); + m.insert("CAP_SYS_PACCT".to_string(), Capability::CAP_SYS_PACCT); + m.insert("CAP_SYS_ADMIN".to_string(), Capability::CAP_SYS_ADMIN); + m.insert("CAP_SYS_BOOT".to_string(), Capability::CAP_SYS_BOOT); + m.insert("CAP_SYS_NICE".to_string(), Capability::CAP_SYS_NICE); + m.insert("CAP_SYS_RESOURCE".to_string(), Capability::CAP_SYS_RESOURCE); + m.insert("CAP_SYS_TIME".to_string(), Capability::CAP_SYS_TIME); + m.insert( + "CAP_SYS_TTY_CONFIG".to_string(), + Capability::CAP_SYS_TTY_CONFIG, + ); + m.insert("CAP_MKNOD".to_string(), Capability::CAP_MKNOD); + m.insert("CAP_LEASE".to_string(), Capability::CAP_LEASE); + m.insert("CAP_AUDIT_WRITE".to_string(), Capability::CAP_AUDIT_WRITE); + m.insert("CAP_AUDIT_CONTROL".to_string(), Capability::CAP_AUDIT_WRITE); + m.insert("CAP_SETFCAP".to_string(), Capability::CAP_SETFCAP); + m.insert("CAP_MAC_OVERRIDE".to_string(), Capability::CAP_MAC_OVERRIDE); + m.insert("CAP_SYSLOG".to_string(), Capability::CAP_SYSLOG); + m.insert("CAP_WAKE_ALARM".to_string(), Capability::CAP_WAKE_ALARM); + m.insert( + "CAP_BLOCK_SUSPEND".to_string(), + Capability::CAP_BLOCK_SUSPEND, + ); + m.insert("CAP_AUDIT_READ".to_string(), Capability::CAP_AUDIT_READ); + m + }; +} + +fn to_capshashset(logger: &Logger, caps: &[String]) -> CapsHashSet { + let mut r = CapsHashSet::new(); + + for cap in caps.iter() { + let c = CAPSMAP.get(cap); + + if c.is_none() { + warn!(logger, "{} is not a cap", cap); + continue; + } + + r.insert(*c.unwrap()); + } + + r +} + +pub fn reset_effective() -> Result<()> { + caps::set(None, CapSet::Effective, caps::all())?; + Ok(()) +} + +pub fn drop_priviledges(logger: &Logger, caps: &LinuxCapabilities) -> Result<()> { + let logger = logger.new(o!("subsystem" => "capabilities")); + + let all = caps::all(); + + for c in all.difference(&to_capshashset(&logger, caps.Bounding.as_ref())) { + caps::drop(None, CapSet::Bounding, *c)?; + } + + caps::set( + None, + CapSet::Effective, + to_capshashset(&logger, caps.Effective.as_ref()), + )?; + caps::set( + None, + CapSet::Permitted, + to_capshashset(&logger, caps.Permitted.as_ref()), + )?; + caps::set( + None, + CapSet::Inheritable, + to_capshashset(&logger, caps.Inheritable.as_ref()), + )?; + + if let Err(_) = caps::set( + None, + CapSet::Ambient, + to_capshashset(&logger, caps.Ambient.as_ref()), + ) { + warn!(logger, "failed to set ambient capability"); + } + + Ok(()) +} diff --git a/src/agent/rustjail/src/cgroups/fs/mod.rs b/src/agent/rustjail/src/cgroups/fs/mod.rs new file mode 100644 index 0000000000..3aa039a020 --- /dev/null +++ b/src/agent/rustjail/src/cgroups/fs/mod.rs @@ -0,0 +1,1463 @@ +// Copyright (c) 2019 Ant Financial +// +// SPDX-License-Identifier: Apache-2.0 +// + +use crate::cgroups::FreezerState; +use crate::cgroups::Manager as CgroupManager; +use crate::container::DEFAULT_DEVICES; +use crate::errors::*; +use lazy_static; +use libc::{self, pid_t}; +use nix::errno::Errno; +use protobuf::{CachedSize, RepeatedField, SingularPtrField, UnknownFields}; +use protocols::agent::{ + BlkioStats, BlkioStatsEntry, CgroupStats, CpuStats, CpuUsage, HugetlbStats, MemoryData, + MemoryStats, PidsStats, ThrottlingData, +}; +use protocols::oci::{LinuxDeviceCgroup, LinuxResources, LinuxThrottleDevice, LinuxWeightDevice}; +use regex::Regex; +use std::collections::HashMap; +use std::fs; + +// Convenience macro to obtain the scope logger +macro_rules! sl { + () => { + slog_scope::logger().new(o!("subsystem" => "cgroups")) + }; +} + +pub struct CpuSet(); +pub struct Cpu(); +pub struct Devices(); +pub struct Memory(); +pub struct CpuAcct(); +pub struct Pids(); +pub struct Blkio(); +pub struct HugeTLB(); +pub struct NetCls(); +pub struct NetPrio(); +pub struct PerfEvent(); +pub struct Freezer(); +pub struct Named(); + +pub trait Subsystem { + fn name(&self) -> String { + "unknown".to_string() + } + + fn set(&self, _dir: &str, _r: &LinuxResources, _update: bool) -> Result<()> { + Ok(()) + } +} + +pub const WILDCARD: i64 = -1; + +lazy_static! { + pub static ref DEFAULT_ALLOWED_DEVICES: Vec = { + let mut v = Vec::new(); + v.push(LinuxDeviceCgroup { + Allow: true, + Type: "c".to_string(), + Major: WILDCARD, + Minor: WILDCARD, + Access: "m".to_string(), + unknown_fields: UnknownFields::default(), + cached_size: CachedSize::default(), + }); + + v.push(LinuxDeviceCgroup { + Allow: true, + Type: "b".to_string(), + Major: WILDCARD, + Minor: WILDCARD, + Access: "m".to_string(), + unknown_fields: UnknownFields::default(), + cached_size: CachedSize::default(), + }); + + v.push(LinuxDeviceCgroup { + Allow: true, + Type: "c".to_string(), + Major: 5, + Minor: 1, + Access: "rwm".to_string(), + unknown_fields: UnknownFields::default(), + cached_size: CachedSize::default(), + }); + + v.push(LinuxDeviceCgroup { + Allow: true, + Type: "c".to_string(), + Major: 136, + Minor: WILDCARD, + Access: "rwm".to_string(), + unknown_fields: UnknownFields::default(), + cached_size: CachedSize::default(), + }); + + v.push(LinuxDeviceCgroup { + Allow: true, + Type: "c".to_string(), + Major: 5, + Minor: 2, + Access: "rwm".to_string(), + unknown_fields: UnknownFields::default(), + cached_size: CachedSize::default(), + }); + + v.push(LinuxDeviceCgroup { + Allow: true, + Type: "c".to_string(), + Major: 10, + Minor: 200, + Access: "rwm".to_string(), + unknown_fields: UnknownFields::default(), + cached_size: CachedSize::default(), + }); + + v + }; + pub static ref BMAP: HashMap = { + let mut m = HashMap::new(); + m.insert("k".to_string(), KiB); + m.insert("m".to_string(), MiB); + m.insert("g".to_string(), GiB); + m.insert("t".to_string(), TiB); + m.insert("p".to_string(), PiB); + m + }; + pub static ref DMAP: HashMap = { + let mut m = HashMap::new(); + m.insert("k".to_string(), KB); + m.insert("m".to_string(), MB); + m.insert("g".to_string(), GB); + m.insert("t".to_string(), TB); + m.insert("p".to_string(), PB); + m + }; + pub static ref DABBRS: Vec = { + let m = vec![ + "B".to_string(), + "KB".to_string(), + "MB".to_string(), + "GB".to_string(), + "TB".to_string(), + "PB".to_string(), + "EB".to_string(), + "ZB".to_string(), + "YB".to_string(), + ]; + m + }; + pub static ref BABBRS: Vec = { + let m = vec![ + "B".to_string(), + "KiB".to_string(), + "MiB".to_string(), + "GiB".to_string(), + "TiB".to_string(), + "PiB".to_string(), + "EiB".to_string(), + "ZiB".to_string(), + "YiB".to_string(), + ]; + m + }; + pub static ref HUGEPAGESIZES: Vec = { + let m = match get_hugepage_sizes() { + Err(_) => Vec::new(), + Ok(s) => s, + }; + + m + }; +} + +pub const KB: u128 = 1000; +pub const MB: u128 = 1000 * KB; +pub const GB: u128 = 1000 * MB; +pub const TB: u128 = 1000 * GB; +pub const PB: u128 = 1000 * TB; + +pub const KiB: u128 = 1024; +pub const MiB: u128 = 1024 * KiB; +pub const GiB: u128 = 1024 * MiB; +pub const TiB: u128 = 1024 * GiB; +pub const PiB: u128 = 1024 * TiB; + +pub const HUGETLB_BASE: &'static str = "hugetlb"; +pub const HUGETLB_USAGE: &'static str = "usage_in_bytes"; +pub const HUGETLB_MAX_USAGE: &'static str = "max_usage_in_bytes"; +pub const HUGETLB_FAILCNT: &'static str = "failcnt"; + +fn parse_size(s: &str, m: &HashMap) -> Result { + let re = Regex::new(r"(?P\d+)(?P[kKmMgGtTpP]?)[bB]?$")?; + let caps = re.captures(s).unwrap(); + + let num = caps.name("num"); + let size: u128 = if num.is_some() { + num.unwrap().as_str().trim().parse::()? + } else { + return Err(nix::Error::Sys(Errno::EINVAL).into()); + }; + + let q = caps.name("mul"); + let mul: u128 = if q.is_some() { + let t = m.get(q.unwrap().as_str()); + if t.is_some() { + *t.unwrap() + } else { + return Err(nix::Error::Sys(Errno::EINVAL).into()); + } + } else { + return Err(nix::Error::Sys(Errno::EINVAL).into()); + }; + + Ok(size * mul) +} + +fn custom_size(mut size: f64, base: f64, m: &Vec) -> String { + let mut i = 0; + while size > base { + size /= base; + i += 1; + } + + format!("{}{}", size, m[i].as_str()) +} + +pub const HUGEPAGESIZE_DIR: &'static str = "/sys/kernel/mm/hugepages"; + +fn get_hugepage_sizes() -> Result> { + let mut m = Vec::new(); + for e in fs::read_dir(HUGEPAGESIZE_DIR)? { + let name = e?.file_name().into_string().unwrap(); + let parts: Vec<&str> = name.split('-').collect(); + if parts.len() != 2 { + continue; + } + let size = parse_size(parts[1], &BMAP)?; + m.push(custom_size(size as f64, 1024.0, DABBRS.as_ref())); + } + + Ok(m) +} + +pub const CPUSET_CPUS: &'static str = "cpuset.cpus"; +pub const CPUSET_MEMS: &'static str = "cpuset.mems"; +pub const CGROUP_PROCS: &'static str = "cgroup.procs"; +pub const CPU_RT_PERIOD_US: &'static str = "cpu.rt_period_us"; +pub const CPU_RT_RUNTIME_US: &'static str = "cpu.rt_runtime_us"; +pub const CPU_SHARES: &'static str = "cpu.shares"; +pub const CPU_CFS_QUOTA_US: &'static str = "cpu.cfs_quota_us"; +pub const CPU_CFS_PERIOD_US: &'static str = "cpu.cfs_period_us"; +pub const DEVICES_ALLOW: &'static str = "devices.allow"; +pub const DEVICES_DENY: &'static str = "devices.deny"; +pub const MEMORY_LIMIT: &'static str = "memory.limit_in_bytes"; +pub const MEMORY_SOFT_LIMIT: &'static str = "memory.soft_limit_in_bytes"; +pub const MEMSW_LIMIT: &'static str = "memory.memsw.limit_in_bytes"; +pub const KMEM_LIMIT: &'static str = "memory.kmem.limit_in_bytes"; +pub const KMEM_TCP_LIMIT: &'static str = "memory.kmem.tcp.limit_in_bytes"; +pub const SWAPPINESS: &'static str = "memory.swappiness"; +pub const OOM_CONTROL: &'static str = "memory.oom_control"; +pub const PIDS_MAX: &'static str = "pids.max"; +pub const BLKIO_WEIGHT: &'static str = "blkio.weight"; +pub const BLKIO_LEAF_WEIGHT: &'static str = "blkio.leaf_weight"; +pub const BLKIO_WEIGHT_DEVICE: &'static str = "blkio.weight_device"; +pub const BLKIO_LEAF_WEIGHT_DEVICE: &'static str = "blkio.leaf_weight_device"; +pub const BLKIO_READ_BPS_DEVICE: &'static str = "blkio.throttle.read_bps_device"; +pub const BLKIO_WRITE_BPS_DEVICE: &'static str = "blkio.throttle.write_bps_device"; +pub const BLKIO_READ_IOPS_DEVICE: &'static str = "blkio.throttle.read_iops_device"; +pub const BLKIO_WRITE_IOPS_DEVICE: &'static str = "blkio.throttle.write_iops_device"; +pub const NET_CLS_CLASSID: &'static str = "net_cls.classid"; +pub const NET_PRIO_IFPRIOMAP: &'static str = "net_prio.ifpriomap"; + +pub const CPU_STAT: &'static str = "cpu.stat"; +pub const CPUACCT_STAT: &'static str = "cpuacct.stat"; +pub const NANO_PER_SECOND: u64 = 1000000000; +pub const CPUACCT_USAGE: &'static str = "cpuacct.usage"; +pub const CPUACCT_PERCPU: &'static str = "cpuacct.usage_percpu"; +pub const MEMORY_STAT: &'static str = "memory.stat"; +pub const MEM_USAGE: &'static str = "usage_in_bytes"; +pub const MEM_MAX_USAGE: &'static str = "max_usage_in_bytes"; +pub const MEM_FAILCNT: &'static str = "failcnt"; +pub const MEM_LIMIT: &'static str = "limit_in_bytes"; +pub const MEM_HIERARCHY: &'static str = "memory.use_hierarchy"; +pub const PIDS_CURRENT: &'static str = "pids.current"; +pub const BLKIO_SECTORS: &'static str = "blkio.sectors_recursive"; +pub const BLKIO_IO_SERVICE_BYTES: &'static str = "blkio.io_service_bytes_recursive"; +pub const BLKIO_IO_SERVICED: &'static str = "blkio.io_serviced_recursive"; +pub const BLKIO_IO_QUEUED: &'static str = "blkio.io_queued_recursive"; +pub const BLKIO_IO_SERVICE_TIME: &'static str = "blkio.io_service_time_recursive"; +pub const BLKIO_IO_WAIT_TIME: &'static str = "blkio.io_wait_time_recursive"; +pub const BLKIO_IO_MERGED: &'static str = "blkio.io_merged_recursive"; +pub const BLKIO_TIME: &'static str = "blkio.time_recursive"; +pub const BLKIO_THROTTLE_IO_SERVICE_BYTES: &'static str = "blkio.throttle.io_service_bytes"; +pub const BLKIO_THROTTLE_IO_SERVICED: &'static str = "blkio.throttle.io_serviced"; + +lazy_static! { + pub static ref CLOCK_TICKS: f64 = { + let n = unsafe { libc::sysconf(libc::_SC_CLK_TCK) }; + + n as f64 + }; +} + +pub fn init_static() { + lazy_static::initialize(&DEFAULT_ALLOWED_DEVICES); + lazy_static::initialize(&BMAP); + lazy_static::initialize(&DMAP); + lazy_static::initialize(&BABBRS); + lazy_static::initialize(&DABBRS); + lazy_static::initialize(&HUGEPAGESIZES); + lazy_static::initialize(&CLOCK_TICKS); +} + +fn write_file(dir: &str, file: &str, v: T) -> Result<()> +where + T: ToString, +{ + let p = format!("{}/{}", dir, file); + info!(sl!(), "{}", p.as_str()); + fs::write(p.as_str(), v.to_string().as_bytes())?; + Ok(()) +} + +fn read_file(dir: &str, file: &str) -> Result { + let p = format!("{}/{}", dir, file); + let ret = fs::read_to_string(p.as_str())?; + Ok(ret) +} + +fn copy_parent(dir: &str, file: &str) -> Result<()> { + let parent = if let Some(index) = dir.rfind('/') { + &dir[..index] + } else { + return Err(ErrorKind::ErrorCode("cannot copy file from parent".to_string()).into()); + }; + + match read_file(parent, file) { + Ok(v) => { + if !v.trim().is_empty() { + info!(sl!(), "value: \"{}\"", v.as_str().trim()); + return write_file(dir, file, v); + } else { + copy_parent(parent, file)?; + return copy_parent(dir, file); + } + } + Err(Error(ErrorKind::Io(e), _)) => { + if e.kind() == std::io::ErrorKind::NotFound { + copy_parent(parent, file)?; + return copy_parent(dir, file); + } + return Err(ErrorKind::Io(e).into()); + } + Err(e) => return Err(e.into()), + } +} + +fn write_nonzero(dir: &str, file: &str, v: i128) -> Result<()> { + if v != 0 { + write_file(dir, file, v.to_string())?; + } + + Ok(()) +} + +fn try_write_nonzero(dir: &str, file: &str, v: i128) -> Result<()> { + match write_nonzero(dir, file, v) { + Ok(_) => Ok(()), + Err(Error(ErrorKind::Io(e), _)) => { + if e.kind() == std::io::ErrorKind::PermissionDenied { + return Ok(()); + } else { + return Err(ErrorKind::Io(e).into()); + } + } + e => e, + } +} + +fn remove(dir: &str) -> Result<()> { + fs::remove_dir_all(dir)?; + Ok(()) +} + +fn apply(dir: &str, pid: pid_t) -> Result<()> { + write_file(dir, CGROUP_PROCS, pid)?; + Ok(()) +} + +fn try_write_file(dir: &str, file: &str, v: T) -> Result<()> { + match write_file(dir, file, v) { + Err(e) => { + let err = Errno::last(); + if err == Errno::EINVAL || err == Errno::ENODEV || err == Errno::ERANGE { + warn!(sl!(), "Invalid Arguments!"); + return Ok(()); + } + + info!(sl!(), "{}", err.desc()); + + return Err(e); + } + + Ok(_) => {} + } + + Ok(()) +} + +impl Subsystem for CpuSet { + fn name(&self) -> String { + "cpuset".to_string() + } + + fn set(&self, dir: &str, r: &LinuxResources, update: bool) -> Result<()> { + let mut cpus: &str = ""; + let mut mems: &str = ""; + + if r.CPU.is_some() { + let cpu = r.CPU.as_ref().unwrap(); + cpus = cpu.Cpus.as_str(); + mems = cpu.Mems.as_str(); + } + + // For updatecontainer, just set the new value + if update { + if !cpus.is_empty() { + try_write_file(dir, CPUSET_CPUS, cpus)?; + } + + if !mems.is_empty() { + try_write_file(dir, CPUSET_MEMS, mems)?; + } + + return Ok(()); + } + + // for the first time + + if !update { + copy_parent(dir, CPUSET_CPUS)?; + copy_parent(dir, CPUSET_MEMS)?; + } + + // cpuset and mems can be invalid + // how to deal with it? Just ingore error for now + if !cpus.is_empty() { + try_write_file(dir, CPUSET_CPUS, cpus)?; + } + + if !mems.is_empty() { + info!(sl!(), "{}", mems); + try_write_file(dir, CPUSET_MEMS, mems)?; + } + + Ok(()) + } +} + +impl Subsystem for Cpu { + fn name(&self) -> String { + "cpu".to_string() + } + + fn set(&self, dir: &str, r: &LinuxResources, _update: bool) -> Result<()> { + if r.CPU.is_none() { + return Ok(()); + } + + let cpu = r.CPU.as_ref().unwrap(); + + try_write_nonzero(dir, CPU_RT_PERIOD_US, cpu.RealtimePeriod as i128)?; + try_write_nonzero(dir, CPU_RT_RUNTIME_US, cpu.RealtimeRuntime as i128)?; + write_nonzero(dir, CPU_SHARES, cpu.Shares as i128)?; + write_nonzero(dir, CPU_CFS_QUOTA_US, cpu.Quota as i128)?; + write_nonzero(dir, CPU_CFS_PERIOD_US, cpu.Period as i128)?; + + Ok(()) + } +} + +fn get_param_key_value(dir: &str, file: &str) -> Result> { + let mut m = HashMap::new(); + let p = format!("{}/{}", dir, file); + + for l in fs::read_to_string(p.as_str())?.lines() { + let t: Vec<&str> = l.split(' ').collect(); + if t.len() != 2 { + continue; + } + + m.insert(t[0].to_string(), t[1].to_string()); + } + + Ok(m) +} + +fn get_param_key_u64(dir: &str, file: &str) -> Result> { + let mut m = HashMap::new(); + let p = format!("{}/{}", dir, file); + + for l in fs::read_to_string(p.as_str())?.lines() { + let t: Vec<&str> = l.split(' ').collect(); + if t.len() != 2 { + continue; + } + + m.insert(t[0].to_string(), t[1].trim().parse::()?); + } + + Ok(m) +} + +fn get_param_u64(dir: &str, file: &str) -> Result { + let p = format!("{}/{}", dir, file); + let ret = fs::read_to_string(p.as_str())?.trim().parse::()?; + Ok(ret) +} + +impl Cpu { + fn get_stats(&self, dir: &str) -> Result { + let h = get_param_key_u64(dir, CPU_STAT)?; + + Ok(ThrottlingData { + periods: *h.get("nr_periods").unwrap(), + throttled_periods: *h.get("nr_throttled").unwrap(), + throttled_time: *h.get("throttled_time").unwrap(), + unknown_fields: UnknownFields::default(), + cached_size: CachedSize::default(), + }) + } +} + +impl Subsystem for CpuAcct { + fn name(&self) -> String { + "cpuacct".to_string() + } + + fn set(&self, _dir: &str, _r: &LinuxResources, _update: bool) -> Result<()> { + Ok(()) + } +} + +fn get_cpuacct_percpu_usage(dir: &str) -> Result> { + let mut m = Vec::new(); + let file = format!("{}/{}", dir, CPUACCT_PERCPU); + + for n in fs::read_to_string(file.as_str())?.split(' ') { + m.push(n.trim().parse::()?); + } + + Ok(m) +} + +fn get_percpu_usage(dir: &str, file: &str) -> Result> { + let mut m = Vec::new(); + let p = format!("{}/{}", dir, file); + info!(sl!(), "{}", p.as_str()); + + for n in fs::read_to_string(p.as_str())?.split(' ') { + info!(sl!(), "{}", n); + if !n.trim().is_empty() { + m.push(n.trim().parse::()?); + } + } + + Ok(m) +} + +impl CpuAcct { + fn get_stats(&self, dir: &str) -> Result { + let h = get_param_key_u64(dir, CPUACCT_STAT)?; + + let usage_in_usermode = + (((*h.get("user").unwrap() * NANO_PER_SECOND) as f64) / *CLOCK_TICKS) as u64; + let usage_in_kernelmode = + (((*h.get("system").unwrap() * NANO_PER_SECOND) as f64) / *CLOCK_TICKS) as u64; + + info!(sl!(), "stat"); + + let total_usage = get_param_u64(dir, CPUACCT_USAGE)?; + info!(sl!(), "usage"); + + let percpu_usage = get_percpu_usage(dir, CPUACCT_PERCPU)?; + info!(sl!(), "percpu"); + + Ok(CpuUsage { + total_usage, + percpu_usage, + usage_in_kernelmode, + usage_in_usermode, + unknown_fields: UnknownFields::default(), + cached_size: CachedSize::default(), + }) + } +} + +fn write_device(d: &LinuxDeviceCgroup, dir: &str) -> Result<()> { + let file = if d.Allow { DEVICES_ALLOW } else { DEVICES_DENY }; + + let major = if d.Major == WILDCARD { + "*".to_string() + } else { + d.Major.to_string() + }; + + let minor = if d.Minor == WILDCARD { + "*".to_string() + } else { + d.Minor.to_string() + }; + + let t = if d.Type.is_empty() { + "a" + } else { + d.Type.as_str() + }; + + let v = format!( + "{} {}:{} {}", + t, + major.as_str(), + minor.as_str(), + d.Access.as_str() + ); + + info!(sl!(), "{}", v.as_str()); + + write_file(dir, file, v.as_str()) +} + +impl Subsystem for Devices { + fn name(&self) -> String { + "devices".to_string() + } + + fn set(&self, dir: &str, r: &LinuxResources, _update: bool) -> Result<()> { + for d in r.Devices.iter() { + write_device(d, dir)?; + } + + for d in DEFAULT_DEVICES.iter() { + let td = LinuxDeviceCgroup { + Allow: true, + Type: d.Type.clone(), + Major: d.Major, + Minor: d.Minor, + Access: "rwm".to_string(), + unknown_fields: UnknownFields::default(), + cached_size: CachedSize::default(), + }; + + write_device(&td, dir)?; + } + + for d in DEFAULT_ALLOWED_DEVICES.iter() { + write_device(d, dir)?; + } + + Ok(()) + } +} + +fn try_write(dir: &str, file: &str, v: T) -> Result<()> +where + T: ToString, +{ + match write_file(dir, file, v) { + Err(Error(ErrorKind::Io(e), _)) => { + if e.kind() != std::io::ErrorKind::PermissionDenied + && e.kind() != std::io::ErrorKind::Other + { + return Err(ErrorKind::Io(e).into()); + } + + return Ok(()); + } + + Err(e) => return Err(e.into()), + + Ok(_) => return Ok(()), + } +} + +impl Subsystem for Memory { + fn name(&self) -> String { + "memory".to_string() + } + + fn set(&self, dir: &str, r: &LinuxResources, update: bool) -> Result<()> { + if r.Memory.is_none() { + return Ok(()); + } + + let memory = r.Memory.as_ref().unwrap(); + // initialize kmem limits for accounting + if !update { + try_write(dir, KMEM_LIMIT, 1)?; + try_write(dir, KMEM_LIMIT, -1)?; + } + + write_nonzero(dir, MEMORY_LIMIT, memory.Limit as i128)?; + write_nonzero(dir, MEMORY_SOFT_LIMIT, memory.Reservation as i128)?; + + try_write_nonzero(dir, MEMSW_LIMIT, memory.Swap as i128)?; + try_write_nonzero(dir, KMEM_LIMIT, memory.Kernel as i128)?; + + write_nonzero(dir, KMEM_TCP_LIMIT, memory.KernelTCP as i128)?; + + if memory.Swappiness <= 100 { + write_file(dir, SWAPPINESS, memory.Swappiness)?; + } + + if memory.DisableOOMKiller { + write_file(dir, OOM_CONTROL, 1)?; + } + + Ok(()) + } +} + +fn get_exist_memory_data(dir: &str, sub: &str) -> Result> { + let res = match get_memory_data(dir, sub) { + Err(Error(ErrorKind::Io(e), _)) => { + if e.kind() == std::io::ErrorKind::NotFound { + None + } else { + return Err(ErrorKind::Io(e).into()); + } + } + + Ok(r) => Some(r), + + Err(e) => return Err(e.into()), + }; + + Ok(res) +} + +fn get_memory_data(dir: &str, sub: &str) -> Result { + let base = "memory"; + let (fusage, fmax_usage, ffailcnt, flimit) = if sub.is_empty() { + ( + format!("{}.{}", base, MEM_USAGE), + format!("{}.{}", base, MEM_MAX_USAGE), + format!("{}.{}", base, MEM_FAILCNT), + format!("{}.{}", base, MEM_LIMIT), + ) + } else { + ( + format!("{}.{}.{}", base, sub, MEM_USAGE), + format!("{}.{}.{}", base, sub, MEM_MAX_USAGE), + format!("{}.{}.{}", base, sub, MEM_FAILCNT), + format!("{}.{}.{}", base, sub, MEM_LIMIT), + ) + }; + + let usage = get_param_u64(dir, fusage.as_str())?; + let max_usage = get_param_u64(dir, fmax_usage.as_str())?; + let failcnt = get_param_u64(dir, ffailcnt.as_str())?; + let limit = get_param_u64(dir, flimit.as_str())?; + + Ok(MemoryData { + usage, + max_usage, + failcnt, + limit, + unknown_fields: UnknownFields::default(), + cached_size: CachedSize::default(), + }) +} + +impl Memory { + fn get_stats(&self, dir: &str) -> Result { + let h = get_param_key_u64(dir, MEMORY_STAT)?; + let cache = *h.get("cache").unwrap(); + info!(sl!(), "cache"); + + let value = get_param_u64(dir, MEM_HIERARCHY)?; + let use_hierarchy = if value == 1 { true } else { false }; + + info!(sl!(), "hierarchy"); + + // gte memory datas + let usage = SingularPtrField::from_option(get_exist_memory_data(dir, "")?); + let swap_usage = SingularPtrField::from_option(get_exist_memory_data(dir, "memsw")?); + let kernel_usage = SingularPtrField::from_option(get_exist_memory_data(dir, "kmem")?); + + Ok(MemoryStats { + cache, + usage, + swap_usage, + kernel_usage, + use_hierarchy, + stats: h, + unknown_fields: UnknownFields::default(), + cached_size: CachedSize::default(), + }) + } +} + +impl Subsystem for Pids { + fn name(&self) -> String { + "pids".to_string() + } + + fn set(&self, dir: &str, r: &LinuxResources, _update: bool) -> Result<()> { + if r.Pids.is_none() { + return Ok(()); + } + + let pids = r.Pids.as_ref().unwrap(); + + let v = if pids.Limit > 0 { + pids.Limit.to_string() + } else { + "max".to_string() + }; + + write_file(dir, PIDS_MAX, v.as_str())?; + + Ok(()) + } +} + +fn get_param_string(dir: &str, file: &str) -> Result { + let p = format!("{}/{}", dir, file); + + let c = fs::read_to_string(p.as_str())?; + + Ok(c) +} + +impl Pids { + fn get_stats(&self, dir: &str) -> Result { + let current = get_param_u64(dir, PIDS_CURRENT)?; + let c = get_param_string(dir, PIDS_MAX)?; + + let limit = if c.contains("max") { + 0 + } else { + c.trim().parse::()? + }; + + Ok(PidsStats { + current, + limit, + unknown_fields: UnknownFields::default(), + cached_size: CachedSize::default(), + }) + } +} + +#[inline] +fn weight(d: &LinuxWeightDevice) -> (String, String) { + ( + format!("{}:{} {}", d.Major, d.Minor, d.Weight), + format!("{}:{} {}", d.Major, d.Minor, d.LeafWeight), + ) +} + +#[inline] +fn rate(d: &LinuxThrottleDevice) -> String { + format!("{}:{} {}", d.Major, d.Minor, d.Rate) +} + +fn write_blkio_device(dir: &str, file: &str, v: T) -> Result<()> { + match write_file(dir, file, v) { + Err(Error(ErrorKind::Io(e), _)) => { + // only ignore ENODEV + if e.kind() == std::io::ErrorKind::Other { + let raw = std::io::Error::last_os_error().raw_os_error().unwrap(); + if Errno::from_i32(raw) == Errno::ENODEV { + return Ok(()); + } + } + + return Err(ErrorKind::Io(e).into()); + } + + Err(e) => return Err(e.into()), + + Ok(_) => {} + } + + Ok(()) +} + +impl Subsystem for Blkio { + fn name(&self) -> String { + "blkio".to_string() + } + + fn set(&self, dir: &str, r: &LinuxResources, _update: bool) -> Result<()> { + if r.BlockIO.is_none() { + return Ok(()); + } + + let blkio = r.BlockIO.as_ref().unwrap(); + + write_nonzero(dir, BLKIO_WEIGHT, blkio.Weight as i128)?; + write_nonzero(dir, BLKIO_LEAF_WEIGHT, blkio.LeafWeight as i128)?; + + for d in blkio.WeightDevice.iter() { + let (w, lw) = weight(d); + write_blkio_device(dir, BLKIO_WEIGHT_DEVICE, w)?; + write_blkio_device(dir, BLKIO_LEAF_WEIGHT_DEVICE, lw)?; + } + + for d in blkio.ThrottleReadBpsDevice.iter() { + write_blkio_device(dir, BLKIO_READ_BPS_DEVICE, rate(d))?; + } + + for d in blkio.ThrottleWriteBpsDevice.iter() { + write_blkio_device(dir, BLKIO_WRITE_BPS_DEVICE, rate(d))?; + } + + for d in blkio.ThrottleReadIOPSDevice.iter() { + write_blkio_device(dir, BLKIO_READ_IOPS_DEVICE, rate(d))?; + } + + for d in blkio.ThrottleWriteIOPSDevice.iter() { + write_blkio_device(dir, BLKIO_WRITE_IOPS_DEVICE, rate(d))?; + } + + Ok(()) + } +} + +fn get_blkio_stat(dir: &str, file: &str) -> Result> { + let p = format!("{}/{}", dir, file); + let mut m = RepeatedField::new(); + + for l in fs::read_to_string(p.as_str())?.lines() { + let parts: Vec<&str> = l.split(' ').collect(); + + if parts.len() < 3 { + if parts.len() == 2 && parts[0].to_lowercase() == "total".to_string() { + continue; + } else { + return Err(nix::Error::Sys(Errno::EINVAL).into()); + } + } + + let op = parts[1].to_string(); + let value = parts[2].parse::()?; + + let devno: Vec<&str> = parts[0].split(':').collect(); + + if devno.len() != 2 { + return Err(nix::Error::Sys(Errno::EINVAL).into()); + } + + let major = devno[0].parse::()?; + let minor = devno[1].parse::()?; + + m.push(BlkioStatsEntry { + major, + minor, + op, + value, + unknown_fields: UnknownFields::default(), + cached_size: CachedSize::default(), + }); + } + + /* + if m.len() == 0 { + // return Err here? not sure about it + return Err(nix::Error::Sys(Errno:ENODATA).into()); + } + */ + + Ok(m) +} +impl Blkio { + fn get_stats(&self, dir: &str) -> Result { + let mut m = BlkioStats::new(); + let entry = get_blkio_stat(dir, BLKIO_IO_SERVICED)?; + + if entry.len() == 0 { + // fall back to generic stats + // blkio.throttle.io_service_bytes, + // maybe io_service_bytes_recursive? + // stick to runc for now + m.io_service_bytes_recursive = get_blkio_stat(dir, BLKIO_THROTTLE_IO_SERVICE_BYTES)?; + m.io_serviced_recursive = get_blkio_stat(dir, BLKIO_THROTTLE_IO_SERVICED)?; + } else { + // cfq stats + m.sectors_recursive = get_blkio_stat(dir, BLKIO_SECTORS)?; + m.io_service_bytes_recursive = get_blkio_stat(dir, BLKIO_IO_SERVICE_BYTES)?; + m.io_serviced_recursive = get_blkio_stat(dir, BLKIO_IO_SERVICED)?; + m.io_queued_recursive = get_blkio_stat(dir, BLKIO_IO_QUEUED)?; + m.io_service_time_recursive = get_blkio_stat(dir, BLKIO_IO_SERVICE_TIME)?; + m.io_wait_time_recursive = get_blkio_stat(dir, BLKIO_IO_WAIT_TIME)?; + m.io_merged_recursive = get_blkio_stat(dir, BLKIO_IO_MERGED)?; + m.io_time_recursive = get_blkio_stat(dir, BLKIO_TIME)?; + } + + Ok(m) + } +} + +impl Subsystem for HugeTLB { + fn name(&self) -> String { + "hugetlb".to_string() + } + + fn set(&self, dir: &str, r: &LinuxResources, _update: bool) -> Result<()> { + for l in r.HugepageLimits.iter() { + let file = format!("hugetlb.{}.limit_in_bytes", l.Pagesize); + write_file(dir, file.as_str(), l.Limit)?; + } + Ok(()) + } +} + +impl HugeTLB { + fn get_stats(&self, dir: &str) -> Result> { + let mut h = HashMap::new(); + for pagesize in HUGEPAGESIZES.iter() { + let fusage = format!("{}.{}.{}", HUGETLB_BASE, pagesize, HUGETLB_USAGE); + let fmax = format!("{}.{}.{}", HUGETLB_BASE, pagesize, HUGETLB_MAX_USAGE); + let ffailcnt = format!("{}.{}.{}", HUGETLB_BASE, pagesize, HUGETLB_FAILCNT); + + let usage = get_param_u64(dir, fusage.as_str())?; + let max_usage = get_param_u64(dir, fmax.as_str())?; + let failcnt = get_param_u64(dir, ffailcnt.as_str())?; + + h.insert( + pagesize.to_string(), + HugetlbStats { + usage, + max_usage, + failcnt, + unknown_fields: UnknownFields::default(), + cached_size: CachedSize::default(), + }, + ); + } + + Ok(h) + } +} + +impl Subsystem for NetCls { + fn name(&self) -> String { + "net_cls".to_string() + } + + fn set(&self, dir: &str, r: &LinuxResources, _update: bool) -> Result<()> { + if r.Network.is_none() { + return Ok(()); + } + + let network = r.Network.as_ref().unwrap(); + + write_nonzero(dir, NET_CLS_CLASSID, network.ClassID as i128)?; + + Ok(()) + } +} + +impl Subsystem for NetPrio { + fn name(&self) -> String { + "net_prio".to_string() + } + + fn set(&self, dir: &str, r: &LinuxResources, _update: bool) -> Result<()> { + if r.Network.is_none() { + return Ok(()); + } + + let network = r.Network.as_ref().unwrap(); + + for p in network.Priorities.iter() { + let prio = format!("{} {}", p.Name, p.Priority); + + try_write_file(dir, NET_PRIO_IFPRIOMAP, prio)?; + } + + Ok(()) + } +} + +impl Subsystem for PerfEvent { + fn name(&self) -> String { + "perf_event".to_string() + } + + fn set(&self, _dir: &str, _r: &LinuxResources, _update: bool) -> Result<()> { + Ok(()) + } +} + +impl Subsystem for Freezer { + fn name(&self) -> String { + "freezer".to_string() + } + + fn set(&self, _dir: &str, _r: &LinuxResources, _update: bool) -> Result<()> { + Ok(()) + } +} + +impl Subsystem for Named { + fn name(&self) -> String { + "name=systemd".to_string() + } + + fn set(&self, _dir: &str, _r: &LinuxResources, _update: bool) -> Result<()> { + Ok(()) + } +} + +fn get_subsystem(name: &str) -> Result> { + match name { + "cpuset" => Ok(Box::new(CpuSet())), + "cpu" => Ok(Box::new(Cpu())), + "devices" => Ok(Box::new(Devices())), + "memory" => Ok(Box::new(Memory())), + "cpuacct" => Ok(Box::new(CpuAcct())), + "pids" => Ok(Box::new(Pids())), + "blkio" => Ok(Box::new(Blkio())), + "hugetlb" => Ok(Box::new(HugeTLB())), + "net_cls" => Ok(Box::new(NetCls())), + "net_prio" => Ok(Box::new(NetPrio())), + "perf_event" => Ok(Box::new(PerfEvent())), + "freezer" => Ok(Box::new(Freezer())), + "name=systemd" => Ok(Box::new(Named())), + _ => Err(nix::Error::Sys(Errno::EINVAL).into()), + } +} + +pub const PATHS: &'static str = "/proc/self/cgroup"; +pub const MOUNTS: &'static str = "/proc/self/mountinfo"; + +fn get_paths() -> Result> { + let mut m = HashMap::new(); + for l in fs::read_to_string(PATHS)?.lines() { + let fl: Vec<&str> = l.split(':').collect(); + if fl.len() != 3 { + info!(sl!(), "Corrupted cgroup data!"); + continue; + } + + let keys: Vec<&str> = fl[1].split(',').collect(); + for key in &keys { + m.insert(key.to_string(), fl[2].to_string()); + } + } + Ok(m) +} + +fn get_mounts() -> Result> { + let mut m = HashMap::new(); + let paths = get_paths()?; + + for l in fs::read_to_string(MOUNTS)?.lines() { + let p: Vec<&str> = l.split(" - ").collect(); + let pre: Vec<&str> = p[0].split(' ').collect(); + let post: Vec<&str> = p[1].split(' ').collect(); + + if post.len() != 3 { + warn!(sl!(), "mountinfo corrupted!"); + continue; + } + + if post[0] != "cgroup" && post[0] != "cgroup2" { + continue; + } + + let names: Vec<&str> = post[2].split(',').collect(); + + for name in &names { + if paths.contains_key(*name) { + m.insert(name.to_string(), pre[4].to_string()); + } + } + } + + Ok(m) +} + +fn get_procs(dir: &str) -> Result> { + let file = format!("{}/{}", dir, CGROUP_PROCS); + let mut m = Vec::new(); + + for l in fs::read_to_string(file.as_str())?.lines() { + m.push(l.trim().parse::()?); + } + + Ok(m) +} + +fn get_all_procs(dir: &str) -> Result> { + let mut m = Vec::new(); + + for e in fs::read_dir(dir)? { + let path = e?.path(); + + if path.is_dir() { + m.append(get_all_procs(path.to_str().unwrap())?.as_mut()); + } + + if path.is_file() && path.ends_with(CGROUP_PROCS) { + let dir = path.parent().unwrap().to_str().unwrap(); + + m.append(get_procs(dir)?.as_mut()); + + return Ok(m); + } + + if path.is_file() { + continue; + } + } + + Ok(m) +} + +#[derive(Debug, Clone)] +pub struct Manager { + pub paths: HashMap, + pub mounts: HashMap, + pub rels: HashMap, + pub cpath: String, +} + +pub const THAWED: &'static str = "THAWED"; +pub const FROZEN: &'static str = "FROZEN"; + +impl CgroupManager for Manager { + fn apply(&self, pid: pid_t) -> Result<()> { + for (key, value) in &self.paths { + info!(sl!(), "apply cgroup {}", key); + apply(value, pid)?; + } + + Ok(()) + } + + fn set(&self, spec: &LinuxResources, update: bool) -> Result<()> { + for (key, value) in &self.paths { + let _ = fs::create_dir_all(value); + let sub = get_subsystem(key)?; + info!(sl!(), "setting cgroup {}", key); + sub.set(value, spec, update)?; + } + + Ok(()) + } + + fn get_stats(&self) -> Result { + // CpuStats + info!(sl!(), "cpu_usage"); + let cpu_usage = if self.paths.get("cpuacct").is_some() { + SingularPtrField::some(CpuAcct().get_stats(self.paths.get("cpuacct").unwrap())?) + } else { + SingularPtrField::none() + }; + + info!(sl!(), "throttling_data"); + let throttling_data = if self.paths.get("cpu").is_some() { + SingularPtrField::some(Cpu().get_stats(self.paths.get("cpu").unwrap())?) + } else { + SingularPtrField::none() + }; + + info!(sl!(), "cpu_stats"); + let cpu_stats = if cpu_usage.is_none() && throttling_data.is_none() { + SingularPtrField::none() + } else { + SingularPtrField::some(CpuStats { + cpu_usage, + throttling_data, + unknown_fields: UnknownFields::default(), + cached_size: CachedSize::default(), + }) + }; + + // Memorystats + info!(sl!(), "memory_stats"); + let memory_stats = if self.paths.get("memory").is_some() { + SingularPtrField::some(Memory().get_stats(self.paths.get("memory").unwrap())?) + } else { + SingularPtrField::none() + }; + + // PidsStats + info!(sl!(), "pids_stats"); + let pids_stats = if self.paths.get("pids").is_some() { + SingularPtrField::some(Pids().get_stats(self.paths.get("pids").unwrap())?) + } else { + SingularPtrField::none() + }; + + // BlkioStats + info!(sl!(), "blkio_stats"); + let blkio_stats = if self.paths.get("blkio").is_some() { + SingularPtrField::some(Blkio().get_stats(self.paths.get("blkio").unwrap())?) + } else { + SingularPtrField::none() + }; + + // HugetlbStats + info!(sl!(), "hugetlb_stats"); + let hugetlb_stats = if self.paths.get("hugetlb").is_some() { + HugeTLB().get_stats(self.paths.get("hugetlb").unwrap())? + } else { + HashMap::new() + }; + + Ok(CgroupStats { + cpu_stats, + memory_stats, + pids_stats, + blkio_stats, + hugetlb_stats, + unknown_fields: UnknownFields::default(), + cached_size: CachedSize::default(), + }) + } + + fn get_paths(&self) -> Result> { + Ok(self.paths.clone()) + } + + fn freeze(&self, state: FreezerState) -> Result<()> { + if state == THAWED || state == FROZEN { + if self.paths.get("freezer").is_some() { + let dir = self.paths.get("freezer").unwrap(); + write_file(dir, "freezer.state", state)?; + } + } else { + if !state.is_empty() { + // invalid state + return Err(nix::Error::Sys(Errno::EINVAL).into()); + } + } + Ok(()) + } + + fn destroy(&mut self) -> Result<()> { + for (_, d) in &self.paths { + remove(d)?; + } + + self.paths = HashMap::new(); + + Ok(()) + } + + fn get_pids(&self) -> Result> { + let m = if self.paths.get("devices").is_some() { + get_procs(self.paths.get("devices").unwrap())? + } else { + return Err(ErrorKind::ErrorCode("no devices cgroup".to_string()).into()); + }; + + Ok(m) + } + + fn get_all_pids(&self) -> Result> { + let m = if self.paths.get("devices").is_some() { + get_all_procs(self.paths.get("devices").unwrap())? + } else { + return Err(ErrorKind::ErrorCode("no devices cgroup".to_string()).into()); + }; + + Ok(m) + } +} + +impl Manager { + pub fn new(cpath: &str) -> Result { + let mut m = HashMap::new(); + + if !cpath.starts_with('/') { + return Err(nix::Error::Sys(Errno::EINVAL).into()); + } + + let paths = get_paths()?; + let mounts = get_mounts()?; + + for (key, value) in &paths { + let mnt = mounts.get(key); + + if mnt.is_none() { + continue; + } + + let p = if value == "/" { + format!("{}{}", mnt.unwrap(), cpath) + } else { + format!("{}{}{}", mnt.unwrap(), value, cpath) + }; + + m.insert(key.to_string(), p); + } + + Ok(Self { + paths: m, + mounts, + rels: paths, + cpath: cpath.to_string(), + }) + } + + pub fn update_cpuset_path(&self, cpuset: &str) -> Result<()> { + let root = if self.mounts.get("cpuset").is_some() { + self.mounts.get("cpuset").unwrap() + } else { + return Err(nix::Error::Sys(Errno::ENOENT).into()); + }; + + let relss = if self.rels.get("cpuset").is_some() { + self.rels.get("cpuset").unwrap() + } else { + return Err(nix::Error::Sys(Errno::ENOENT).into()); + }; + + let mut dir: String = root.to_string(); + let rels: Vec<&str> = relss.split('/').collect(); + let cpaths: Vec<&str> = self.cpath.as_str().split('/').collect(); + + for d in rels.iter() { + if d.is_empty() { + continue; + } + + dir.push('/'); + dir.push_str(d); + write_file(dir.as_str(), CPUSET_CPUS, cpuset)?; + } + + for d in cpaths.iter() { + if d.is_empty() { + continue; + } + + dir.push('/'); + dir.push_str(d); + write_file(dir.as_str(), CPUSET_CPUS, cpuset)?; + } + + Ok(()) + } +} + +pub fn get_guest_cpuset() -> Result { + let m = get_mounts()?; + + if m.get("cpuset").is_none() { + warn!(sl!(), "no cpuset cgroup!"); + return Err(nix::Error::Sys(Errno::ENOENT).into()); + } + + get_param_string(m.get("cpuset").unwrap(), CPUSET_CPUS) +} diff --git a/src/agent/rustjail/src/cgroups/mod.rs b/src/agent/rustjail/src/cgroups/mod.rs new file mode 100644 index 0000000000..c55f864702 --- /dev/null +++ b/src/agent/rustjail/src/cgroups/mod.rs @@ -0,0 +1,49 @@ +// Copyright (c) 2019 Ant Financial +// +// SPDX-License-Identifier: Apache-2.0 +// + +use crate::errors::*; +// use crate::configs::{FreezerState, Config}; +use protocols::agent::CgroupStats; +use protocols::oci::LinuxResources; +use std::collections::HashMap; + +pub mod fs; +pub mod systemd; + +pub type FreezerState = &'static str; + +pub trait Manager { + fn apply(&self, _pid: i32) -> Result<()> { + Err(ErrorKind::ErrorCode("not supported!".to_string()).into()) + } + + fn get_pids(&self) -> Result> { + Err(ErrorKind::ErrorCode("not supported!".to_string()).into()) + } + + fn get_all_pids(&self) -> Result> { + Err(ErrorKind::ErrorCode("not supported!".to_string()).into()) + } + + fn get_stats(&self) -> Result { + Err(ErrorKind::ErrorCode("not supported!".to_string()).into()) + } + + fn freeze(&self, _state: FreezerState) -> Result<()> { + Err(ErrorKind::ErrorCode("not supported!".to_string()).into()) + } + + fn destroy(&mut self) -> Result<()> { + Err(ErrorKind::ErrorCode("not supported!".to_string()).into()) + } + + fn get_paths(&self) -> Result> { + Err(ErrorKind::ErrorCode("not supported!".to_string()).into()) + } + + fn set(&self, _container: &LinuxResources, _update: bool) -> Result<()> { + Err(ErrorKind::ErrorCode("not supported!".to_string()).into()) + } +} diff --git a/src/agent/rustjail/src/cgroups/systemd.rs b/src/agent/rustjail/src/cgroups/systemd.rs new file mode 100644 index 0000000000..669f6d5bbb --- /dev/null +++ b/src/agent/rustjail/src/cgroups/systemd.rs @@ -0,0 +1,10 @@ +// Copyright (c) 2019 Ant Financial +// +// SPDX-License-Identifier: Apache-2.0 +// + +use crate::cgroups::Manager as CgroupManager; + +pub struct Manager {} + +impl CgroupManager for Manager {} diff --git a/src/agent/rustjail/src/configs/device.rs b/src/agent/rustjail/src/configs/device.rs new file mode 100644 index 0000000000..0c59f6affe --- /dev/null +++ b/src/agent/rustjail/src/configs/device.rs @@ -0,0 +1,56 @@ +// Copyright (c) 2019 Ant Financial +// +// SPDX-License-Identifier: Apache-2.0 +// + +use libc::*; +use serde; +#[macro_use] +use serde_derive; +use serde_json; + +#[derive(Serialize, Deserialize, Debug)] +pub struct Device { + #[serde(default)] + r#type: char, + #[serde(default)] + path: String, + #[serde(default)] + major: i64, + #[serde(default)] + minor: i64, + #[serde(default)] + permissions: String, + #[serde(default)] + file_mode: mode_t, + #[serde(default)] + uid: i32, + #[serde(default)] + gid: i32, + #[serde(default)] + allow: bool, +} + +#[derive(Serialize, Deserialize, Debug)] +pub struct BlockIODevice { + #[serde(default)] + major: i64, + #[serde(default)] + minor: i64, +} + +#[derive(Serialize, Deserialize, Debug)] +pub struct WeightDevice { + block: BlockIODevice, + #[serde(default)] + weight: u16, + #[serde(default, rename = "leafWeight")] + leaf_weight: u16, +} + +#[derive(Serialize, Deserialize, Debug)] +pub struct ThrottleDevice { + block: BlockIODevice, + #[serde(default)] + rate: u64, +} diff --git a/src/agent/rustjail/src/configs/mod.rs b/src/agent/rustjail/src/configs/mod.rs new file mode 100644 index 0000000000..2ee991a917 --- /dev/null +++ b/src/agent/rustjail/src/configs/mod.rs @@ -0,0 +1,494 @@ +// Copyright (c) 2019 Ant Financial +// +// SPDX-License-Identifier: Apache-2.0 +// + +use serde; +#[macro_use] +use serde_derive; +use serde_json; + +use protocols::oci::State as OCIState; + +use crate::errors::*; +use std::collections::HashMap; +use std::fmt; +use std::path::PathBuf; +use std::time::Duration; + +use nix::unistd; + +use self::device::{Device, ThrottleDevice, WeightDevice}; +use self::namespaces::Namespaces; +use crate::specconv::CreateOpts; + +pub mod device; +pub mod namespaces; +pub mod validator; + +#[derive(Serialize, Deserialize, Debug)] +pub struct Rlimit { + #[serde(default)] + r#type: i32, + #[serde(default)] + hard: i32, + #[serde(default)] + soft: i32, +} + +#[derive(Serialize, Deserialize, Debug)] +pub struct IDMap { + #[serde(default)] + container_id: i32, + #[serde(default)] + host_id: i32, + #[serde(default)] + size: i32, +} + +type Action = i32; + +#[derive(Serialize, Deserialize, Debug)] +pub struct Seccomp { + #[serde(default)] + default_action: Action, + #[serde(default)] + architectures: Vec, + #[serde(default)] + syscalls: Vec, +} + +type Operator = i32; + +#[derive(Serialize, Deserialize, Debug)] +pub struct Arg { + #[serde(default)] + index: u32, + #[serde(default)] + value: u64, + #[serde(default)] + value_two: u64, + #[serde(default)] + op: Operator, +} + +#[derive(Serialize, Deserialize, Debug)] +pub struct Syscall { + #[serde(default, skip_serializing_if = "String::is_empty")] + name: String, + #[serde(default)] + action: Action, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + args: Vec, +} + +#[derive(Serialize, Deserialize, Debug)] +pub struct Config<'a> { + #[serde(default)] + no_pivot_root: bool, + #[serde(default)] + parent_death_signal: i32, + #[serde(default)] + rootfs: String, + #[serde(default)] + readonlyfs: bool, + #[serde(default, rename = "rootPropagation")] + root_propagation: i32, + #[serde(default)] + mounts: Vec, + #[serde(default)] + devices: Vec, + #[serde(default)] + mount_label: String, + #[serde(default)] + hostname: String, + #[serde(default)] + namespaces: Namespaces, + #[serde(default)] + capabilities: Option, + #[serde(default)] + networks: Vec, + #[serde(default)] + routes: Vec, + #[serde(default)] + cgroups: Option>, + #[serde(default, skip_serializing_if = "String::is_empty")] + apparmor_profile: String, + #[serde(default, skip_serializing_if = "String::is_empty")] + process_label: String, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + rlimits: Vec, + #[serde(default)] + oom_score_adj: Option, + #[serde(default)] + uid_mappings: Vec, + #[serde(default)] + gid_mappings: Vec, + #[serde(default)] + mask_paths: Vec, + #[serde(default)] + readonly_paths: Vec, + #[serde(default)] + sysctl: HashMap, + #[serde(default)] + seccomp: Option, + #[serde(default)] + no_new_privileges: bool, + hooks: Option, + #[serde(default)] + version: String, + #[serde(default)] + labels: Vec, + #[serde(default)] + no_new_keyring: bool, + #[serde(default)] + intel_rdt: Option, + #[serde(default)] + rootless_euid: bool, + #[serde(default)] + rootless_cgroups: bool, +} + +#[derive(Serialize, Deserialize, Debug)] +pub struct Hooks { + prestart: Vec>, + poststart: Vec>, + poststop: Vec>, +} +#[derive(Serialize, Deserialize, Debug)] +pub struct Capabilities { + bounding: Vec, + effective: Vec, + inheritable: Vec, + permitted: Vec, + ambient: Vec, +} + +pub trait Hook { + fn run(&self, state: &OCIState) -> Result<()>; +} + +pub struct FuncHook { + // run: fn(&OCIState) -> Result<()>, +} + +#[derive(Serialize, Deserialize, Debug)] +pub struct Command { + #[serde(default)] + path: String, + #[serde(default)] + args: Vec, + #[serde(default)] + env: Vec, + #[serde(default)] + dir: String, + #[serde(default)] + timeout: Duration, +} + +pub struct CommandHook { + command: Command, +} + +#[derive(Serialize, Deserialize, Debug)] +pub struct Mount { + #[serde(default)] + source: String, + #[serde(default)] + destination: String, + #[serde(default)] + device: String, + #[serde(default)] + flags: i32, + #[serde(default)] + propagation_flags: Vec, + #[serde(default)] + data: String, + #[serde(default)] + relabel: String, + #[serde(default)] + extensions: i32, + #[serde(default)] + premount_cmds: Vec, + #[serde(default)] + postmount_cmds: Vec, +} + +#[derive(Serialize, Deserialize, Debug)] +pub struct HugepageLimit { + #[serde(default)] + page_size: String, + #[serde(default)] + limit: u64, +} + +#[derive(Serialize, Deserialize, Debug)] +pub struct IntelRdt { + #[serde(default, skip_serializing_if = "String::is_empty")] + l3_cache_schema: String, + #[serde( + default, + rename = "memBwSchema", + skip_serializing_if = "String::is_empty" + )] + mem_bw_schema: String, +} + +pub type FreezerState = String; + +#[derive(Serialize, Deserialize, Debug)] +pub struct Cgroup<'a> { + #[serde(default, skip_serializing_if = "String::is_empty")] + name: String, + #[serde(default, skip_serializing_if = "String::is_empty")] + parent: String, + #[serde(default)] + path: String, + #[serde(default)] + scope_prefix: String, + paths: HashMap, + resource: &'a Resources<'a>, +} + +#[derive(Serialize, Deserialize, Debug)] +pub struct Resources<'a> { + #[serde(default)] + allow_all_devices: bool, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + allowed_devices: Vec<&'a Device>, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + denied_devices: Vec<&'a Device>, + #[serde(default)] + devices: Vec<&'a Device>, + #[serde(default)] + memory: i64, + #[serde(default)] + memory_reservation: i64, + #[serde(default)] + memory_swap: i64, + #[serde(default)] + kernel_memory: i64, + #[serde(default)] + kernel_memory_tcp: i64, + #[serde(default)] + cpu_shares: u64, + #[serde(default)] + cpu_quota: i64, + #[serde(default)] + cpu_period: u64, + #[serde(default)] + cpu_rt_quota: i64, + #[serde(default)] + cpu_rt_period: u64, + #[serde(default)] + cpuset_cpus: String, + #[serde(default)] + cpuset_mems: String, + #[serde(default)] + pids_limit: i64, + #[serde(default)] + blkio_weight: u64, + #[serde(default)] + blkio_leaf_weight: u64, + #[serde(default)] + blkio_weight_device: Vec<&'a WeightDevice>, + #[serde(default)] + blkio_throttle_read_bps_device: Vec<&'a ThrottleDevice>, + #[serde(default)] + blkio_throttle_write_bps_device: Vec<&'a ThrottleDevice>, + #[serde(default)] + blkio_throttle_read_iops_device: Vec<&'a ThrottleDevice>, + #[serde(default)] + blkio_throttle_write_iops_device: Vec<&'a ThrottleDevice>, + #[serde(default)] + freezer: FreezerState, + #[serde(default)] + hugetlb_limit: Vec<&'a HugepageLimit>, + #[serde(default)] + oom_kill_disable: bool, + #[serde(default)] + memory_swapiness: u64, + #[serde(default)] + net_prio_ifpriomap: Vec<&'a IfPrioMap>, + #[serde(default)] + net_cls_classid_u: u32, +} + +#[derive(Serialize, Deserialize, Debug)] +pub struct Network { + #[serde(default)] + r#type: String, + #[serde(default)] + name: String, + #[serde(default)] + bridge: String, + #[serde(default)] + mac_address: String, + #[serde(default)] + address: String, + #[serde(default)] + gateway: String, + #[serde(default)] + ipv6_address: String, + #[serde(default)] + ipv6_gateway: String, + #[serde(default)] + mtu: i32, + #[serde(default)] + txqueuelen: i32, + #[serde(default)] + host_interface_name: String, + #[serde(default)] + hairpin_mode: bool, +} + +#[derive(Serialize, Deserialize, Debug)] +pub struct Route { + #[serde(default)] + destination: String, + #[serde(default)] + source: String, + #[serde(default)] + gateway: String, + #[serde(default)] + interface_name: String, +} + +#[derive(Serialize, Deserialize, Debug)] +pub struct IfPrioMap { + #[serde(default)] + interface: String, + #[serde(default)] + priority: i32, +} + +impl IfPrioMap { + fn cgroup_string(&self) -> String { + format!("{} {}", self.interface, self.priority) + } +} + +/* +impl Config { + fn new(opts: &CreateOpts) -> Result { + if opts.spec.is_none() { + return Err(ErrorKind::ErrorCode("invalid createopts!".into())); + } + + let root = unistd::getcwd().chain_err(|| "cannot getwd")?; + let root = root.as_path().canonicalize().chain_err(|| + "cannot resolve root into absolute path")?; + let mut root = root.into(); + let cwd = root.clone(); + + let spec = opts.spec.as_ref().unwrap(); + if spec.root.is_none() { + return Err(ErrorKind::ErrorCode("no root".into())); + } + + let rootfs = PathBuf::from(&spec.root.as_ref().unwrap().path); + if rootfs.is_relative() { + root = format!("{}/{}", root, rootfs.into()); + } + + // handle annotations + let mut label = spec.annotations + .iter() + .map(|(key, value)| format!("{}={}", key, value)).collect(); + label.push(format!("bundle={}", cwd)); + + let mut config = Config { + rootfs: root, + no_pivot_root: opts.no_pivot_root, + readonlyfs: spec.root.as_ref().unwrap().readonly, + hostname: spec.hostname.clone(), + labels: label, + no_new_keyring: opts.no_new_keyring, + rootless_euid: opts.rootless_euid, + rootless_cgroups: opts.rootless_cgroups, + }; + + config.mounts = Vec::new(); + for m in &spec.mounts { + config.mounts.push(Mount::new(&cwd, &m)?); + } + + config.devices = create_devices(&spec)?; + config.cgroups = Cgroups::new(&opts)?; + + if spec.linux.as_ref().is_none() { + return Err(ErrorKind::ErrorCode("no linux configuration".into())); + } + let linux = spec.linux.as_ref().unwrap(); + + let propagation = MOUNTPROPAGATIONMAPPING.get(linux.rootfs_propagation); + if propagation.is_none() { + Err(ErrorKind::ErrorCode("rootfs propagation not support".into())); + } + + config.root_propagation = propagation.unwrap(); + if config.no_pivot_root && (config.root_propagation & MSFlags::MSPRIVATE != 0) { + return Err(ErrorKind::ErrorCode("[r]private is not safe without pivot root".into())); + } + + // handle namespaces + let m: HashMap = HashMap::new(); + for ns in &linux.namespaces { + if NAMESPACEMAPPING.get(&ns.r#type.as_str()).is_none() { + return Err(ErrorKind::ErrorCode("namespace don't exist".into())); + } + + if m.get(&ns.r#type).is_some() { + return Err(ErrorKind::ErrorCode(format!("duplicate ns {}", ns.r#type))); + } + + m.insert(ns.r#type, ns.path); + } + + if m.contains_key(oci::NETWORKNAMESPACE) { + let path = m.get(oci::NETWORKNAMESPACE).unwrap(); + if path == "" { + config.networks = vec![Network { + r#type: "loopback", + }]; + } + } + + if m.contains_key(oci::USERNAMESPACE) { + setup_user_namespace(&spec, &mut config)?; + } + + config.namespaces = m.iter().map(|(key, value)| Namespace { + r#type: key, + path: value, + }).collect(); + config.mask_paths = linux.mask_paths; + config.readonly_path = linux.readonly_path; + config.mount_label = linux.mount_label; + config.sysctl = linux.sysctl; + config.seccomp = None; + config.intelrdt = None; + + if spec.process.is_some() { + let process = spec.process.as_ref().unwrap(); + config.oom_score_adj = process.oom_score_adj; + config.process_label = process.selinux_label.clone(); + if process.capabilities.as_ref().is_some() { + let cap = process.capabilities.as_ref().unwrap(); + config.capabilities = Some(Capabilities { + ..cap + }) + } + } + config.hooks = None; + config.version = spec.version; + Ok(config) + } +} + + +impl Mount { + fn new(cwd: &str, m: &oci::Mount) -> Result { + } +} +*/ diff --git a/src/agent/rustjail/src/configs/namespaces.rs b/src/agent/rustjail/src/configs/namespaces.rs new file mode 100644 index 0000000000..547f640e40 --- /dev/null +++ b/src/agent/rustjail/src/configs/namespaces.rs @@ -0,0 +1,46 @@ +// Copyright (c) 2019 Ant Financial +// +// SPDX-License-Identifier: Apache-2.0 +// + +use serde; +#[macro_use] +use serde_derive; +use serde_json; + +use std::collections::HashMap; +#[macro_use] +use lazy_static; + +pub type NamespaceType = String; +pub type Namespaces = Vec; + +#[derive(Serialize, Deserialize, Debug)] +pub struct Namespace { + #[serde(default)] + r#type: NamespaceType, + #[serde(default)] + path: String, +} + +pub const NEWNET: &'static str = "NEWNET"; +pub const NEWPID: &'static str = "NEWPID"; +pub const NEWNS: &'static str = "NEWNS"; +pub const NEWUTS: &'static str = "NEWUTS"; +pub const NEWUSER: &'static str = "NEWUSER"; +pub const NEWCGROUP: &'static str = "NEWCGROUP"; +pub const NEWIPC: &'static str = "NEWIPC"; + +lazy_static! { + static ref TYPETONAME: HashMap<&'static str, &'static str> = { + let mut m = HashMap::new(); + m.insert("pid", "pid"); + m.insert("network", "net"); + m.insert("mount", "mnt"); + m.insert("user", "user"); + m.insert("uts", "uts"); + m.insert("ipc", "ipc"); + m.insert("cgroup", "cgroup"); + m + }; +} diff --git a/src/agent/rustjail/src/configs/validator.rs b/src/agent/rustjail/src/configs/validator.rs new file mode 100644 index 0000000000..97e8168716 --- /dev/null +++ b/src/agent/rustjail/src/configs/validator.rs @@ -0,0 +1,23 @@ +// Copyright (c) 2019 Ant Financial +// +// SPDX-License-Identifier: Apache-2.0 +// + +use crate::configs::Config; +use std::io::Result; + +pub trait Validator { + fn validate(&self, config: &Config) -> Result<()> { + Ok(()) + } +} + +pub struct ConfigValidator {} + +impl Validator for ConfigValidator {} + +impl ConfigValidator { + fn new() -> Self { + ConfigValidator {} + } +} diff --git a/src/agent/rustjail/src/container.rs b/src/agent/rustjail/src/container.rs new file mode 100644 index 0000000000..90a1d7cdff --- /dev/null +++ b/src/agent/rustjail/src/container.rs @@ -0,0 +1,1589 @@ +// Copyright (c) 2019 Ant Financial +// +// SPDX-License-Identifier: Apache-2.0 +// + +use lazy_static; +use protocols::oci::{Hook, Linux, LinuxNamespace, LinuxResources, POSIXRlimit, Spec}; +use serde_json; +use std::ffi::CString; +use std::fs; +use std::mem; +use std::os::unix::io::RawFd; +use std::path::{Path, PathBuf}; +use std::time::SystemTime; +// use crate::sync::Cond; +use libc::pid_t; +use protocols::oci::{LinuxDevice, LinuxIDMapping}; +use std::clone::Clone; +use std::fmt::Display; +use std::process::Command; + +// use crate::configs::namespaces::{NamespaceType}; +use crate::cgroups::Manager as CgroupManager; +use crate::process::Process; +// use crate::intelrdt::Manager as RdtManager; +use crate::errors::*; +use crate::specconv::CreateOpts; +// use crate::stats::Stats; +use crate::capabilities::{self, CAPSMAP}; +use crate::cgroups::fs::{self as fscgroup, Manager as FsManager}; +use crate::{mount, validator}; + +use protocols::agent::StatsContainerResponse; + +use nix::errno::Errno; +use nix::fcntl::{self, OFlag}; +use nix::pty; +use nix::sched::{self, CloneFlags}; +use nix::sys::signal::{self, Signal}; +use nix::sys::socket::{self, ControlMessage, ControlMessageOwned, MsgFlags}; +use nix::sys::stat::{self, Mode}; +use nix::sys::uio::IoVec; +use nix::unistd::{self, ForkResult, Gid, Pid, Uid}; +use nix::Error; + +use libc; +use protobuf::{CachedSize, SingularPtrField, UnknownFields}; + +use oci::State as OCIState; +use std::collections::HashMap; + +use slog::{debug, info, o, Logger}; + +const STATE_FILENAME: &'static str = "state.json"; +const EXEC_FIFO_FILENAME: &'static str = "exec.fifo"; +const VER_MARKER: &'static str = "1.2.5"; + +type Status = Option; +pub type Config = CreateOpts; +type NamespaceType = String; + +/* +impl Status { + fn to_string(&self) -> String { + match *self { + Some(ref v) => v.to_string(), + None => "Unknown Status".to_string(), + } + } +} +*/ + +lazy_static! { + static ref NAMESPACES: HashMap<&'static str, CloneFlags> = { + let mut m = HashMap::new(); + m.insert("user", CloneFlags::CLONE_NEWUSER); + m.insert("ipc", CloneFlags::CLONE_NEWIPC); + m.insert("pid", CloneFlags::CLONE_NEWPID); + m.insert("network", CloneFlags::CLONE_NEWNET); + m.insert("mount", CloneFlags::CLONE_NEWNS); + m.insert("uts", CloneFlags::CLONE_NEWUTS); + m.insert("cgroup", CloneFlags::CLONE_NEWCGROUP); + m + }; + +// type to name hashmap, better to be in NAMESPACES + static ref TYPETONAME: HashMap<&'static str, &'static str> = { + let mut m = HashMap::new(); + m.insert("ipc", "ipc"); + m.insert("user", "user"); + m.insert("pid", "pid"); + m.insert("network", "net"); + m.insert("mount", "mnt"); + m.insert("cgroup", "cgroup"); + m.insert("uts", "uts"); + m + }; + + pub static ref DEFAULT_DEVICES: Vec = { + let mut v = Vec::new(); + v.push(LinuxDevice { + Path: "/dev/null".to_string(), + Type: "c".to_string(), + Major: 1, + Minor: 3, + FileMode: 0o066, + UID: 0xffffffff, + GID: 0xffffffff, + unknown_fields: UnknownFields::default(), + cached_size: CachedSize::default(), + }); + v.push(LinuxDevice { + Path: "/dev/zero".to_string(), + Type: "c".to_string(), + Major: 1, + Minor: 5, + FileMode: 0o066, + UID: 0xffffffff, + GID: 0xffffffff, + unknown_fields: UnknownFields::default(), + cached_size: CachedSize::default(), + }); + v.push(LinuxDevice { + Path: "/dev/full".to_string(), + Type: String::from("c"), + Major: 1, + Minor: 7, + FileMode: 0o066, + UID: 0xffffffff, + GID: 0xffffffff, + unknown_fields: UnknownFields::default(), + cached_size: CachedSize::default(), + }); + v.push(LinuxDevice { + Path: "/dev/tty".to_string(), + Type: "c".to_string(), + Major: 5, + Minor: 0, + FileMode: 0o066, + UID: 0xffffffff, + GID: 0xffffffff, + unknown_fields: UnknownFields::default(), + cached_size: CachedSize::default(), + }); + v.push(LinuxDevice { + Path: "/dev/urandom".to_string(), + Type: "c".to_string(), + Major: 1, + Minor: 9, + FileMode: 0o066, + UID: 0xffffffff, + GID: 0xffffffff, + unknown_fields: UnknownFields::default(), + cached_size: CachedSize::default(), + }); + v.push(LinuxDevice { + Path: "/dev/random".to_string(), + Type: "c".to_string(), + Major: 1, + Minor: 8, + FileMode: 0o066, + UID: 0xffffffff, + GID: 0xffffffff, + unknown_fields: UnknownFields::default(), + cached_size: CachedSize::default(), + }); + v + }; +} + +#[derive(Serialize, Deserialize, Debug)] +pub struct BaseState { + #[serde(default, skip_serializing_if = "String::is_empty")] + id: String, + #[serde(default)] + init_process_pid: i32, + #[serde(default)] + init_process_start: u64, + /* + #[serde(default)] + created: SystemTime, + config: Config, + */ +} + +pub trait BaseContainer { + fn id(&self) -> String; + fn status(&self) -> Result; + fn state(&self) -> Result; + fn oci_state(&self) -> Result; + fn config(&self) -> Result<&Config>; + fn processes(&self) -> Result>; + fn get_process(&mut self, eid: &str) -> Result<&mut Process>; + fn stats(&self) -> Result; + fn set(&mut self, config: LinuxResources) -> Result<()>; + fn start(&mut self, p: Process) -> Result<()>; + fn run(&mut self, p: Process) -> Result<()>; + fn destroy(&mut self) -> Result<()>; + fn signal(&self, sig: Signal, all: bool) -> Result<()>; + fn exec(&mut self) -> Result<()>; +} + +// LinuxContainer protected by Mutex +// Arc> or just Mutex? +// Or use Mutex as a member of struct, like C? +// a lot of String in the struct might be &str +#[derive(Debug)] +pub struct LinuxContainer +// where T: CgroupManager +{ + pub id: String, + pub root: String, + pub config: Config, + pub cgroup_manager: Option, + pub init_process_pid: pid_t, + pub init_process_start_time: u64, + pub uid_map_path: String, + pub gid_map_path: String, + pub processes: HashMap, + pub status: Status, + pub created: SystemTime, + pub logger: Logger, +} + +#[derive(Serialize, Deserialize, Debug)] +pub struct State { + base: BaseState, + #[serde(default)] + rootless: bool, + #[serde(default, skip_serializing_if = "HashMap::is_empty")] + cgroup_paths: HashMap, + #[serde(default, skip_serializing_if = "HashMap::is_empty")] + namespace_paths: HashMap, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + external_descriptors: Vec, + #[serde(default, skip_serializing_if = "String::is_empty")] + intel_rdt_path: String, +} + +#[derive(Serialize, Deserialize, Debug, Clone)] +pub struct SyncPC { + #[serde(default)] + pid: pid_t, +} + +pub trait Container: BaseContainer { + // fn checkpoint(&self, opts: &CriuOpts) -> Result<()>; + // fn restore(&self, p: &Process, opts: &CriuOpts) -> Result<()>; + fn pause(&self) -> Result<()>; + fn resume(&self) -> Result<()>; + // fn notify_oom(&self) -> Result<(Sender, Receiver)>; + // fn notify_memory_pressure(&self, lvl: PressureLevel) -> Result<(Sender, Receiver)>; +} + +impl BaseContainer for LinuxContainer { + fn id(&self) -> String { + self.id.clone() + } + + fn status(&self) -> Result { + Ok(self.status.clone()) + } + + fn state(&self) -> Result { + Err(ErrorKind::ErrorCode(String::from("not suppoerted")).into()) + } + + fn oci_state(&self) -> Result { + let oci = self.config.spec.as_ref().unwrap(); + let status = self.status().unwrap().unwrap(); + let pid = if status != "stopped".to_string() { + self.init_process_pid + } else { + 0 + }; + + let root = oci.Root.as_ref().unwrap().Path.as_str(); + let path = fs::canonicalize(root)?; + let bundle = path.parent().unwrap().to_str().unwrap().to_string(); + Ok(OCIState { + version: oci.Version.clone(), + id: self.id(), + status, + pid, + bundle, + annotations: oci.Annotations.clone(), + }) + } + + fn config(&self) -> Result<&Config> { + Ok(&self.config) + } + + fn processes(&self) -> Result> { + Ok(self.processes.keys().cloned().collect()) + } + + fn get_process(&mut self, eid: &str) -> Result<&mut Process> { + for (_, v) in self.processes.iter_mut() { + if eid == v.exec_id.as_str() { + return Ok(v); + } + } + + Err(ErrorKind::ErrorCode(format!("invalid eid {}", eid)).into()) + } + + fn stats(&self) -> Result { + let mut r = StatsContainerResponse::default(); + + if self.cgroup_manager.is_some() { + r.cgroup_stats = + SingularPtrField::some(self.cgroup_manager.as_ref().unwrap().get_stats()?); + } + + // what about network interface stats? + + Ok(r) + } + + fn set(&mut self, r: LinuxResources) -> Result<()> { + if self.cgroup_manager.is_some() { + self.cgroup_manager.as_ref().unwrap().set(&r, true)?; + } + self.config + .spec + .as_mut() + .unwrap() + .Linux + .as_mut() + .unwrap() + .Resources = SingularPtrField::some(r); + Ok(()) + } + + fn start(&mut self, mut p: Process) -> Result<()> { + let fifo_file = format!("{}/{}", &self.root, EXEC_FIFO_FILENAME); + info!(self.logger, "enter container.start!"); + let mut fifofd: RawFd = -1; + if p.init { + if let Ok(_) = stat::stat(fifo_file.as_str()) { + return Err(ErrorKind::ErrorCode("exec fifo exists".to_string()).into()); + } + unistd::mkfifo(fifo_file.as_str(), Mode::from_bits(0o622).unwrap())?; + // defer!(fs::remove_file(&fifo_file)?); + + fifofd = fcntl::open( + fifo_file.as_str(), + OFlag::O_PATH | OFlag::O_CLOEXEC, + Mode::from_bits(0).unwrap(), + )?; + } + info!(self.logger, "exec fifo opened!"); + + lazy_static::initialize(&NAMESPACES); + lazy_static::initialize(&DEFAULT_DEVICES); + lazy_static::initialize(&RLIMITMAPS); + lazy_static::initialize(&CAPSMAP); + fscgroup::init_static(); + + if self.config.spec.is_none() { + return Err(ErrorKind::ErrorCode("no spec".to_string()).into()); + } + + let spec = self.config.spec.as_ref().unwrap(); + if spec.Linux.is_none() { + return Err(ErrorKind::ErrorCode("no linux config".to_string()).into()); + } + + let linux = spec.Linux.as_ref().unwrap(); + // get namespace vector to join/new + let nses = get_namespaces(&linux, p.init, self.init_process_pid)?; + info!(self.logger, "got namespaces {:?}!\n", nses); + let mut to_new = CloneFlags::empty(); + let mut to_join = Vec::new(); + let mut pidns = false; + let mut userns = false; + for ns in &nses { + let s = NAMESPACES.get(&ns.Type.as_str()); + if s.is_none() { + return Err(ErrorKind::ErrorCode("invalid ns type".to_string()).into()); + } + let s = s.unwrap(); + + if ns.Path.is_empty() { + to_new.set(*s, true); + } else { + let fd = match fcntl::open(ns.Path.as_str(), OFlag::empty(), Mode::empty()) { + Ok(v) => v, + Err(e) => { + info!( + self.logger, + "cannot open type: {} path: {}", + ns.Type.clone(), + ns.Path.clone() + ); + info!(self.logger, "error is : {}", e.as_errno().unwrap().desc()); + return Err(e.into()); + } + }; + // .chain_err(|| format!("fail to open ns {}", &ns.Type))?; + to_join.push((*s, fd)); + } + + if *s == CloneFlags::CLONE_NEWPID { + pidns = true; + } + } + + if to_new.contains(CloneFlags::CLONE_NEWUSER) { + userns = true; + } + + let mut parent: u32 = 0; + let st = self.oci_state()?; + + let (child, cfd) = match join_namespaces( + &self.logger, + &spec, + to_new, + &to_join, + pidns, + userns, + p.init, + self.config.no_pivot_root, + self.cgroup_manager.as_ref().unwrap(), + &st, + &mut parent, + ) { + Ok((u, v)) => (u, v), + Err(e) => { + if parent == 0 { + info!(self.logger, "parent process error out!"); + return Err(e); + } else if parent == 1 { + info!(self.logger, "child process 1 error out!"); + std::process::exit(-1); + } else { + info!(self.logger, "child process 2 error out!"); + std::process::exit(-2); + } + } + }; + info!(self.logger, "entered namespaces!"); + if child != Pid::from_raw(-1) { + // parent + p.pid = child.as_raw(); + self.status = Some("created".to_string()); + if p.init { + self.init_process_pid = p.pid; + unistd::close(fifofd)?; + } + self.created = SystemTime::now(); + // defer!({ self.processes.insert(p.pid, p); () }); + // parent process need to receive ptmx masterfd + // and set it up in process struct + + unistd::close(p.stdin.unwrap())?; + unistd::close(p.stderr.unwrap())?; + unistd::close(p.stdout.unwrap())?; + + for &(_, fd) in &to_join { + let _ = unistd::close(fd); + } + + // create the pipes for notify process exited + let (exit_pipe_r, exit_pipe_w) = + unistd::pipe2(OFlag::O_CLOEXEC).chain_err(|| "failed to create pipe")?; + p.exit_pipe_w = Some(exit_pipe_w); + p.exit_pipe_r = Some(exit_pipe_r); + + let console_fd = if p.parent_console_socket.is_some() { + p.parent_console_socket.unwrap() + } else { + self.processes.insert(p.pid, p); + return Ok(()); + }; + + let mut v: Vec = vec![0; 40]; + let iov = IoVec::from_mut_slice(v.as_mut_slice()); + let mut c: Vec = vec![0; 40]; + + match socket::recvmsg(console_fd, &[iov], Some(&mut c), MsgFlags::empty()) { + Ok(rmsg) => { + let cmsg: Vec = rmsg.cmsgs().collect(); + // expect the vector lenght 1 + if cmsg.len() != 1 { + return Err( + ErrorKind::ErrorCode("error in semd/recvmsg!".to_string()).into() + ); + } + + match &cmsg[0] { + ControlMessageOwned::ScmRights(v) => { + if v.len() != 1 { + return Err(ErrorKind::ErrorCode( + "error in send/recvmsg!".to_string(), + ) + .into()); + } + + p.term_master = Some(v[0]); + } + // all other cases are error + _ => { + return Err( + ErrorKind::ErrorCode("error in send/recvmsg!".to_string()).into() + ); + } + } + } + Err(e) => return Err(ErrorKind::Nix(e).into()), + } + + unistd::close(p.parent_console_socket.unwrap())?; + unistd::close(p.console_socket.unwrap())?; + + // turn off echo + // let mut term = termios::tcgetattr(p.term_master.unwrap())?; + // term.local_flags &= !(LocalFlags::ECHO | LocalFlags::ICANON); + // termios::tcsetattr(p.term_master.unwrap(), SetArg::TCSANOW, &term)?; + + self.processes.insert(p.pid, p); + + return Ok(()); + } // end parent + + // setup stdio in child process + // need fd to send master fd to parent... store the fd in + // process struct? + setup_stdio(&p)?; + + if to_new.contains(CloneFlags::CLONE_NEWNS) { + info!(self.logger, "finish rootfs!"); + mount::finish_rootfs(spec)?; + } + + if !p.oci.Cwd.is_empty() { + debug!(self.logger, "cwd: {}", p.oci.Cwd.as_str()); + unistd::chdir(p.oci.Cwd.as_str())?; + } + + // setup uid/gid + info!(self.logger, "{:?}", p.oci.clone()); + + if p.oci.User.is_some() { + let guser = p.oci.User.as_ref().unwrap(); + + let uid = Uid::from_raw(guser.UID); + let gid = Gid::from_raw(guser.GID); + + setid(uid, gid)?; + + if !guser.AdditionalGids.is_empty() { + setgroups(guser.AdditionalGids.as_slice())?; + } + } + + // NoNewPeiviledges, Drop capabilities + if p.oci.NoNewPrivileges { + if let Err(_) = prctl::set_no_new_privileges(true) { + return Err( + ErrorKind::ErrorCode("cannot set no new privileges".to_string()).into(), + ); + } + } + + if p.oci.Capabilities.is_some() { + let c = p.oci.Capabilities.as_ref().unwrap(); + info!(self.logger, "drop capabilities!"); + capabilities::drop_priviledges(&self.logger, c)?; + } + + if p.init { + // notify parent to run poststart hooks + // cfd is closed when return from join_namespaces + // should retunr cfile instead of cfd? + write_sync(cfd, 0)?; + } + + // new and the stat parent process + // For init process, we need to setup a lot of things + // For exec process, only need to join existing namespaces, + // the namespaces are got from init process or from + // saved spec. + debug!(self.logger, "before setup execfifo!"); + info!(self.logger, "{}", VER_MARKER); + if p.init { + let fd = fcntl::open( + format!("/proc/self/fd/{}", fifofd).as_str(), + OFlag::O_RDONLY | OFlag::O_CLOEXEC, + Mode::from_bits_truncate(0), + )?; + unistd::close(fifofd)?; + let mut buf: &mut [u8] = &mut [0]; + unistd::read(fd, &mut buf)?; + } + + // exec process + let args = p.oci.Args.to_vec(); + let env = p.oci.Env.to_vec(); + do_exec(&self.logger, &args[0], &args, &env)?; + + Err(ErrorKind::ErrorCode("fail to create container".to_string()).into()) + } + + fn run(&mut self, p: Process) -> Result<()> { + let init = p.init; + self.start(p)?; + + if init { + self.exec()?; + self.status = Some("running".to_string()); + } + + Ok(()) + } + + fn destroy(&mut self) -> Result<()> { + let spec = self.config.spec.as_ref().unwrap(); + let st = self.oci_state()?; + + for pid in self.processes.keys() { + signal::kill(Pid::from_raw(*pid), Some(Signal::SIGKILL))?; + } + + if spec.Hooks.is_some() { + info!(self.logger, "poststop"); + let hooks = spec.Hooks.as_ref().unwrap(); + for h in hooks.Poststop.iter() { + execute_hook(&self.logger, h, &st)?; + } + } + + self.status = Some("stopped".to_string()); + Ok(()) + } + + fn signal(&self, sig: Signal, all: bool) -> Result<()> { + if all { + for pid in self.processes.keys() { + signal::kill(Pid::from_raw(*pid), Some(sig))?; + } + } + + signal::kill(Pid::from_raw(self.init_process_pid), Some(sig))?; + + Ok(()) + } + + fn exec(&mut self) -> Result<()> { + let fifo = format!("{}/{}", &self.root, EXEC_FIFO_FILENAME); + let fd = fcntl::open(fifo.as_str(), OFlag::O_WRONLY, Mode::from_bits_truncate(0))?; + let data: &[u8] = &[0]; + unistd::write(fd, &data)?; + info!(self.logger, "container {} stared", &self.id); + self.init_process_start_time = SystemTime::now() + .duration_since(SystemTime::UNIX_EPOCH) + .unwrap() + .as_secs(); + + self.status = Some("running".to_string()); + unistd::close(fd)?; + + Ok(()) + } +} + +use std::env; + +fn do_exec(logger: &Logger, path: &str, args: &[String], env: &[String]) -> Result<()> { + let logger = logger.new(o!("command" => "exec")); + + let p = CString::new(path.to_string()).unwrap(); + let a: Vec = args + .iter() + .map(|s| CString::new(s.to_string()).unwrap_or_default()) + .collect(); + + for (key, _) in env::vars() { + env::remove_var(key); + } + + for e in env.iter() { + let v: Vec<&str> = e.split("=").collect(); + if v.len() != 2 { + info!(logger, "incorrect env config!"); + } + env::set_var(v[0], v[1]); + } + /* + let env: Vec = env + .iter() + .map(|s| CString::new(s.to_string()).unwrap_or_default()) + .collect(); + */ + // execvp doesn't use env for the search path, so we set env manually + debug!(logger, "exec process right now!"); + if let Err(e) = unistd::execvp(&p, &a) { + info!(logger, "execve failed!!!"); + info!(logger, "binary: {:?}, args: {:?}, envs: {:?}", p, a, env); + match e { + nix::Error::Sys(errno) => { + info!(logger, "{}", errno.desc()); + } + Error::InvalidPath => { + info!(logger, "invalid path"); + } + Error::InvalidUtf8 => { + info!(logger, "invalid utf8"); + } + Error::UnsupportedOperation => { + info!(logger, "unsupported operation"); + } + } + std::process::exit(-2); + } + // should never reach here + Ok(()) +} + +fn get_namespaces(linux: &Linux, init: bool, init_pid: pid_t) -> Result> { + let mut ns: Vec = Vec::new(); + if init { + for i in &linux.Namespaces { + ns.push(LinuxNamespace { + Type: i.Type.clone(), + Path: i.Path.clone(), + unknown_fields: UnknownFields::default(), + cached_size: CachedSize::default(), + }); + } + } else { + for i in NAMESPACES.keys() { + let ns_path = format!("/proc/{}/ns/{}", init_pid, TYPETONAME.get(i).unwrap()); + let ns_path_buf = Path::new(&ns_path).read_link()?; + + let init_ns_path = format!( + "/proc/{}/ns/{}", + unistd::getpid(), + TYPETONAME.get(i).unwrap() + ); + let init_ns_path_buf = Path::new(&init_ns_path).read_link()?; + + // ignore the namespace which is the same with system init namespace, + // since it shouldn't be join. + if !ns_path_buf.eq(&init_ns_path_buf) { + ns.push(LinuxNamespace { + Type: i.to_string(), + Path: ns_path, + unknown_fields: UnknownFields::default(), + cached_size: CachedSize::default(), + }); + } + } + } + Ok(ns) +} + +pub const PIDSIZE: usize = mem::size_of::(); + +fn read_sync(fd: RawFd) -> Result { + let mut v: [u8; PIDSIZE] = [0; PIDSIZE]; + let mut len = 0; + + loop { + match unistd::read(fd, &mut v[len..]) { + Ok(l) => { + len += l; + if len == PIDSIZE { + break; + } + } + + Err(e) => { + if e != Error::from_errno(Errno::EINTR) { + return Err(e.into()); + } + } + } + } + + Ok(pid_t::from_be_bytes(v)) +} + +fn write_sync(fd: RawFd, pid: pid_t) -> Result<()> { + let buf = pid.to_be_bytes(); + let mut len = 0; + + loop { + match unistd::write(fd, &buf[len..]) { + Ok(l) => { + len += l; + if len == PIDSIZE { + break; + } + } + + Err(e) => { + if e != Error::from_errno(Errno::EINTR) { + return Err(e.into()); + } + } + } + } + + Ok(()) +} + +fn join_namespaces( + logger: &Logger, + spec: &Spec, + to_new: CloneFlags, + to_join: &Vec<(CloneFlags, RawFd)>, + pidns: bool, + userns: bool, + init: bool, + no_pivot: bool, + cm: &FsManager, + st: &OCIState, + parent: &mut u32, +) -> Result<(Pid, RawFd)> { + let logger = logger.new(o!("action" => "join-namespaces")); + + // let ccond = Cond::new().chain_err(|| "create cond failed")?; + // let pcond = Cond::new().chain_err(|| "create cond failed")?; + let (pfd, cfd) = unistd::pipe2(OFlag::O_CLOEXEC).chain_err(|| "failed to create pipe")?; + let (crfd, pwfd) = unistd::pipe2(OFlag::O_CLOEXEC)?; + + let linux = spec.Linux.as_ref().unwrap(); + let res = linux.Resources.as_ref(); + + match unistd::fork()? { + ForkResult::Parent { child } => { + // let mut pfile = unsafe { File::from_raw_fd(pfd) }; + unistd::close(cfd)?; + unistd::close(crfd)?; + + //wait child setup user namespace + let _ = read_sync(pfd)?; + + if userns { + // setup uid/gid mappings + write_mappings( + &logger, + &format!("/proc/{}/uid_map", child.as_raw()), + &linux.UIDMappings, + )?; + write_mappings( + &logger, + &format!("/proc/{}/gid_map", child.as_raw()), + &linux.GIDMappings, + )?; + } + + // apply cgroups + if init { + if res.is_some() { + info!(logger, "apply cgroups!"); + cm.set(res.unwrap(), false)?; + } + } + + if res.is_some() { + cm.apply(child.as_raw())?; + } + + write_sync(pwfd, 0)?; + + let mut pid = child.as_raw(); + info!(logger, "first child! {}", pid); + info!(logger, "wait for final child!"); + if pidns { + pid = read_sync(pfd)?; + // pfile.read_to_string(&mut json)?; + /* + let msg: SyncPC = match serde_json::from_reader(&mut pfile) { + Ok(u) => u, + Err(e) => { + match e.classify() { + Category::Io => info!("Io error!"), + Category::Syntax => info!("syntax error!"), + Category::Data => info!("data error!"), + Category::Eof => info!("end of file!"), + } + + return Err(ErrorKind::Serde(e).into()); + } + }; + */ + // notify child continue + info!(logger, "got final child pid! {}", pid); + write_sync(pwfd, 0)?; + info!(logger, "resume child!"); + // wait for child to exit + // Since the child would be reaped by our reaper, so + // there is no need reap the child here. + // wait::waitpid(Some(child), None); + } + // read out child pid here. we don't use + // cgroup to get it + // and the wait for child exit to get grandchild + + if init { + info!(logger, "wait for hook!"); + let _ = read_sync(pfd)?; + + // run prestart hook + if spec.Hooks.is_some() { + info!(logger, "prestart"); + let hooks = spec.Hooks.as_ref().unwrap(); + for h in hooks.Prestart.iter() { + execute_hook(&logger, h, st)?; + } + } + + // notify child run prestart hooks completed + write_sync(pwfd, 0)?; + + // wait to run poststart hook + let _ = read_sync(pfd)?; + //run poststart hook + if spec.Hooks.is_some() { + info!(logger, "poststart"); + let hooks = spec.Hooks.as_ref().unwrap(); + for h in hooks.Poststart.iter() { + execute_hook(&logger, h, st)?; + } + } + } + unistd::close(pfd)?; + unistd::close(pwfd)?; + + return Ok((Pid::from_raw(pid), cfd)); + } + ForkResult::Child => { + *parent = 1; + unistd::close(pfd)?; + unistd::close(pwfd)?; + // set oom_score_adj + + let p = if spec.Process.is_some() { + spec.Process.as_ref().unwrap() + } else { + return Err(nix::Error::Sys(Errno::EINVAL).into()); + }; + + if p.OOMScoreAdj > 0 { + fs::write( + "/proc/self/oom_score_adj", + p.OOMScoreAdj.to_string().as_bytes(), + )? + } + + // set rlimit + for rl in p.Rlimits.iter() { + setrlimit(rl)?; + } + + if userns { + sched::unshare(CloneFlags::CLONE_NEWUSER)?; + } + + write_sync(cfd, 0)?; + let _ = read_sync(crfd)?; + + if userns { + setid(Uid::from_raw(0), Gid::from_raw(0))?; + } + } + } + + // child process continues + // let mut cfile = unsafe { File::from_raw_fd(cfd) }; + let mut mount_fd = -1; + let mut bind_device = false; + for &(s, fd) in to_join { + if s == CloneFlags::CLONE_NEWNS { + mount_fd = fd; + continue; + } + + // just skip user namespace for now + // we cannot join user namespace in multithreaded + // program, which is us(kata-agent using grpc) + // To fix this + // 1. write kata-agent as singlethread program + // 2. use a binary to exec OR self exec to enter + // namespaces before multithreaded, the way + // rustjail works + /* + if s == CloneFlags::CLONE_NEWUSER { + unistd::close(fd)?; + continue; + } + */ + if let Err(e) = sched::setns(fd, s) { + info!(logger, "setns error: {}", e.as_errno().unwrap().desc()); + info!(logger, "setns: ns type: {:?}", s); + if s == CloneFlags::CLONE_NEWUSER { + if e.as_errno().unwrap() != Errno::EINVAL { + return Err(e.into()); + } + } else { + return Err(e.into()); + } + } + unistd::close(fd)?; + + if s == CloneFlags::CLONE_NEWUSER { + setid(Uid::from_raw(0), Gid::from_raw(0))?; + bind_device = true; + } + } + + info!(logger, "to_new: {:?}", to_new); + sched::unshare(to_new & !CloneFlags::CLONE_NEWUSER)?; + + if userns { + bind_device = true; + } + + // create a pipe for sync between parent and child. + // here we should make sure the parent return pid before + // the child notify grand parent to run hooks, otherwise + // both of the parent and his child would write cfd at the same + // time which would mesh the grand parent to read. + let (chfd, phfd) = unistd::pipe2(OFlag::O_CLOEXEC) + .chain_err(|| "failed to create pipe for syncing run hooks")?; + + if pidns { + match unistd::fork()? { + ForkResult::Parent { child } => { + unistd::close(chfd)?; + // set child pid to topmost parent and the exit + write_sync(cfd, child.as_raw())?; + + info!( + logger, + "json: {}", + serde_json::to_string(&SyncPC { + pid: child.as_raw() + }) + .unwrap() + ); + // wait for parent read it and the continue + info!(logger, "after send out child pid!"); + let _ = read_sync(crfd)?; + + // notify child to continue. + write_sync(phfd, 0)?; + std::process::exit(0); + } + ForkResult::Child => { + *parent = 2; + unistd::close(phfd)?; + } + } + } + + if to_new.contains(CloneFlags::CLONE_NEWUTS) { + unistd::sethostname(&spec.Hostname)?; + } + + let rootfs = spec.Root.as_ref().unwrap().Path.as_str(); + let root = fs::canonicalize(rootfs)?; + let rootfs = root.to_str().unwrap(); + + if to_new.contains(CloneFlags::CLONE_NEWNS) { + // setup rootfs + info!(logger, "setup rootfs!"); + mount::init_rootfs(&logger, &spec, &cm.paths, &cm.mounts, bind_device)?; + } + + // wait until parent notified + if pidns { + let _ = read_sync(chfd)?; + } + unistd::close(chfd)?; + + if init { + // notify parent to run prestart hooks + write_sync(cfd, 0)?; + // wait parent run prestart hooks + let _ = read_sync(crfd)?; + } + + unistd::close(crfd)?; + + if mount_fd != -1 { + sched::setns(mount_fd, CloneFlags::CLONE_NEWNS)?; + unistd::close(mount_fd)?; + } + + if to_new.contains(CloneFlags::CLONE_NEWNS) { + // unistd::chroot(rootfs)?; + if no_pivot { + mount::ms_move_root(rootfs)?; + } else { + // pivot root + mount::pivot_rootfs(rootfs)?; + } + + // setup sysctl + set_sysctls(&linux.Sysctl)?; + unistd::chdir("/")?; + if let Err(_) = stat::stat("marker") { + info!(logger, "not in expect root!!"); + } + info!(logger, "in expect rootfs!"); + + if let Err(_) = stat::stat("/bin/sh") { + info!(logger, "no '/bin/sh'???"); + } + } + + // notify parent to continue before block on exec fifo + + info!(logger, "rootfs: {}", &rootfs); + + // block on exec fifo + + Ok((Pid::from_raw(-1), cfd)) +} + +fn setup_stdio(p: &Process) -> Result<()> { + if p.console_socket.is_some() { + // we can setup ptmx master for process + // turn off echo + // let mut term = termios::tcgetattr(0)?; + // termios::cfmakeraw(&mut term); + // term.local_flags &= !(LocalFlags::ECHO | LocalFlags::ICANON); + // term.control_chars[VMIN] = 1; + // term.control_chars[VTIME] = 0; + + let pseduo = pty::openpty(None, None)?; + defer!(unistd::close(pseduo.master).unwrap()); + let data: &[u8] = b"/dev/ptmx"; + let iov = [IoVec::from_slice(&data)]; + let fds = [pseduo.master]; + let cmsg = ControlMessage::ScmRights(&fds); + let mut console_fd = p.console_socket.unwrap(); + + socket::sendmsg(console_fd, &iov, &[cmsg], MsgFlags::empty(), None)?; + + unistd::close(console_fd)?; + unistd::close(p.parent_console_socket.unwrap())?; + console_fd = pseduo.slave; + + unistd::setsid()?; + unsafe { + libc::ioctl(console_fd, libc::TIOCSCTTY); + } + unistd::dup2(console_fd, 0)?; + unistd::dup2(console_fd, 1)?; + unistd::dup2(console_fd, 2)?; + + // turn off echo + // let mut term = termios::tcgetattr(0)?; + // term.local_flags &= !(LocalFlags::ECHO | LocalFlags::ICANON); + // termios::tcsetattr(0, SetArg::TCSANOW, &term)?; + + if console_fd > 2 { + unistd::close(console_fd)?; + } + } else { + // dup stdin/stderr/stdout + unistd::dup2(p.stdin.unwrap(), 0)?; + unistd::dup2(p.stdout.unwrap(), 1)?; + unistd::dup2(p.stderr.unwrap(), 2)?; + + if p.stdin.unwrap() > 2 { + unistd::close(p.stdin.unwrap())?; + } + + if p.stdout.unwrap() > 2 { + unistd::close(p.stdout.unwrap())?; + } + if p.stderr.unwrap() > 2 { + unistd::close(p.stderr.unwrap())?; + } + } + + unistd::close(p.parent_stdin.unwrap())?; + unistd::close(p.parent_stdout.unwrap())?; + unistd::close(p.parent_stderr.unwrap())?; + + Ok(()) +} + +fn write_mappings(logger: &Logger, path: &str, maps: &[LinuxIDMapping]) -> Result<()> { + let mut data = String::new(); + for m in maps { + if m.Size == 0 { + continue; + } + + let val = format!("{} {} {}\n", m.ContainerID, m.HostID, m.Size); + data = data + &val; + } + + info!(logger, "mapping: {}", data); + if !data.is_empty() { + let fd = fcntl::open(path, OFlag::O_WRONLY, Mode::empty())?; + defer!(unistd::close(fd).unwrap()); + match unistd::write(fd, data.as_bytes()) { + Ok(_) => {} + Err(e) => { + info!(logger, "cannot write mapping"); + return Err(e.into()); + } + } + } + Ok(()) +} + +fn setid(uid: Uid, gid: Gid) -> Result<()> { + // set uid/gid + if let Err(e) = prctl::set_keep_capabilities(true) { + bail!(format!("set keep capabilities returned {}", e)); + }; + { + unistd::setresgid(gid, gid, gid)?; + } + { + unistd::setresuid(uid, uid, uid)?; + } + // if we change from zero, we lose effective caps + if uid != Uid::from_raw(0) { + capabilities::reset_effective()?; + } + + if let Err(e) = prctl::set_keep_capabilities(false) { + bail!(format!("set keep capabilities returned {}", e)); + }; + Ok(()) +} + +impl LinuxContainer { + pub fn new + Display + Clone>( + id: T, + base: T, + config: Config, + logger: &Logger, + ) -> Result { + let base = base.into(); + let id = id.into(); + let root = format!("{}/{}", base.as_str(), id.as_str()); + + // validate oci spec + validator::validate(&config)?; + + if let Err(e) = fs::create_dir_all(root.as_str()) { + if e.kind() == std::io::ErrorKind::AlreadyExists { + return Err(e).chain_err(|| format!("container {} already exists", id.as_str())); + } + + return Err(e).chain_err(|| format!("fail to create container directory {}", root)); + } + + unistd::chown( + root.as_str(), + Some(unistd::getuid()), + Some(unistd::getgid()), + ) + .chain_err(|| format!("cannot change onwer of container {} root", id))?; + + if config.spec.is_none() { + return Err(nix::Error::Sys(Errno::EINVAL).into()); + } + + let spec = config.spec.as_ref().unwrap(); + + if spec.Linux.is_none() { + return Err(nix::Error::Sys(Errno::EINVAL).into()); + } + + let linux = spec.Linux.as_ref().unwrap(); + + let cpath = if linux.CgroupsPath.is_empty() { + format!("/{}", id.as_str()) + } else { + linux.CgroupsPath.clone() + }; + + let cgroup_manager = FsManager::new(cpath.as_str())?; + + Ok(LinuxContainer { + id: id, + root, + cgroup_manager: Some(cgroup_manager), + status: Some("stopped".to_string()), + uid_map_path: String::from(""), + gid_map_path: "".to_string(), + config, + processes: HashMap::new(), + created: SystemTime::now(), + init_process_pid: -1, + init_process_start_time: SystemTime::now() + .duration_since(SystemTime::UNIX_EPOCH) + .unwrap() + .as_secs(), + logger: logger.new(o!("module" => "rustjail", "subsystem" => "container")), + }) + } + + fn load>(_id: T, _base: T) -> Result { + Err(ErrorKind::ErrorCode("not supported".to_string()).into()) + } + /* + fn new_parent_process(&self, p: &Process) -> Result> { + let (pfd, cfd) = socket::socketpair(AddressFamily::Unix, + SockType::Stream, SockProtocol::Tcp, + SockFlag::SOCK_CLOEXEC)?; + + let cmd = Command::new(self.init_path) + .args(self.init_args[1..]) + .env("_LIBCONTAINER_INITPIPE", format!("{}", + cfd)) + .env("_LIBCONTAINER_STATEDIR", self.root) + .current_dir(Path::new(self.config.rootfs)) + .stdin(p.stdin) + .stdout(p.stdout) + .stderr(p.stderr); + + if p.console_socket.is_some() { + cmd.env("_LIBCONTAINER_CONSOLE", format!("{}", + unsafe { p.console_socket.unwrap().as_raw_fd() })); + } + + if !p.init { + return self.new_setns_process(p, cmd, pfd, cfd); + } + + let fifo_file = format!("{}/{}", self.root, EXEC_FIFO_FILENAME); + let fifofd = fcntl::open(fifo_file, + OFlag::O_PATH | OFlag::O_CLOEXEC, + Mode::from_bits(0).unwrap())?; + + cmd.env("_LIBCONTAINER_FIFOFD", format!("{}", fifofd)); + + self.new_init_process(p, cmd, pfd, cfd) + } + + fn new_setns_process(&self, p: &Process, cmd: &mut Command, pfd: Rawfd, cfd: Rawfd) -> Result { + } + + fn new_init_process(&self, p: &Process, cmd: &mut Command, pfd: Rawfd, cfd: Rawfd) -> Result { + cmd.env("_LINCONTAINER_INITTYPE", INITSTANDARD); + } + */ +} + +lazy_static! { + pub static ref RLIMITMAPS: HashMap = { + let mut m = HashMap::new(); + m.insert("RLIMIT_CPU".to_string(), libc::RLIMIT_CPU); + m.insert("RLIMIT_FSIZE".to_string(), libc::RLIMIT_FSIZE); + m.insert("RLIMIT_DATA".to_string(), libc::RLIMIT_DATA); + m.insert("RLIMIT_STACK".to_string(), libc::RLIMIT_STACK); + m.insert("RLIMIT_CORE".to_string(), libc::RLIMIT_CORE); + m.insert("RLIMIT_RSS".to_string(), libc::RLIMIT_RSS); + m.insert("RLIMIT_NPROC".to_string(), libc::RLIMIT_NPROC); + m.insert("RLIMIT_NOFILE".to_string(), libc::RLIMIT_NOFILE); + m.insert("RLIMIT_MEMLOCK".to_string(), libc::RLIMIT_MEMLOCK); + m.insert("RLIMIT_AS".to_string(), libc::RLIMIT_AS); + m.insert("RLIMIT_LOCKS".to_string(), libc::RLIMIT_LOCKS); + m.insert("RLIMIT_SIGPENDING".to_string(), libc::RLIMIT_SIGPENDING); + m.insert("RLIMIT_MSGQUEUE".to_string(), libc::RLIMIT_MSGQUEUE); + m.insert("RLIMIT_NICE".to_string(), libc::RLIMIT_NICE); + m.insert("RLIMIT_RTPRIO".to_string(), libc::RLIMIT_RTPRIO); + m.insert("RLIMIT_RTTIME".to_string(), libc::RLIMIT_RTTIME); + m + }; +} + +fn setrlimit(limit: &POSIXRlimit) -> Result<()> { + let rl = libc::rlimit { + rlim_cur: limit.Soft, + rlim_max: limit.Hard, + }; + + let res = if RLIMITMAPS.get(limit.Type.as_str()).is_some() { + *RLIMITMAPS.get(limit.Type.as_str()).unwrap() + } else { + return Err(nix::Error::Sys(Errno::EINVAL).into()); + }; + + let ret = unsafe { libc::setrlimit(res as i32, &rl as *const libc::rlimit) }; + + Errno::result(ret).map(drop)?; + + Ok(()) +} + +fn setgroups(grps: &[libc::gid_t]) -> Result<()> { + let ret = unsafe { libc::setgroups(grps.len(), grps.as_ptr() as *const libc::gid_t) }; + Errno::result(ret).map(drop)?; + Ok(()) +} + +use std::fs::OpenOptions; +use std::io::Write; + +fn set_sysctls(sysctls: &HashMap) -> Result<()> { + for (key, value) in sysctls { + let name = format!("/proc/sys/{}", key.replace('.', "/")); + let mut file = match OpenOptions::new() + .read(true) + .write(true) + .create(false) + .open(name.as_str()) + { + Ok(f) => f, + Err(e) => { + if e.kind() == std::io::ErrorKind::NotFound { + continue; + } + return Err(e.into()); + } + }; + + file.write_all(value.as_bytes())?; + } + + Ok(()) +} + +use std::error::Error as StdError; +use std::io::Read; +use std::os::unix::process::ExitStatusExt; +use std::process::Stdio; +use std::sync::mpsc::{self, RecvTimeoutError}; +use std::thread; +use std::time::Duration; + +fn execute_hook(logger: &Logger, h: &Hook, st: &OCIState) -> Result<()> { + let logger = logger.new(o!("action" => "execute-hook")); + + let binary = PathBuf::from(h.Path.as_str()); + let path = binary.canonicalize()?; + if !path.exists() { + return Err(ErrorKind::Nix(Error::from_errno(Errno::EINVAL)).into()); + } + + let args = h.Args.clone(); + let envs = h.Env.clone(); + let state = serde_json::to_string(st)?; + // state.push_str("\n"); + + let (rfd, wfd) = unistd::pipe2(OFlag::O_CLOEXEC)?; + match unistd::fork()? { + ForkResult::Parent { child: _ch } => { + let status = read_sync(rfd)?; + + info!(logger, "hook child: {}", _ch); + + // let _ = wait::waitpid(_ch, + // Some(WaitPidFlag::WEXITED | WaitPidFlag::__WALL)); + + if status != 0 { + if status == -libc::ETIMEDOUT { + return Err(ErrorKind::Nix(Error::from_errno(Errno::ETIMEDOUT)).into()); + } else if status == -libc::EPIPE { + return Err(ErrorKind::Nix(Error::from_errno(Errno::EPIPE)).into()); + } else { + return Err(ErrorKind::Nix(Error::from_errno(Errno::UnknownErrno)).into()); + } + } + + return Ok(()); + } + + ForkResult::Child => { + let (tx, rx) = mpsc::channel(); + let (tx_logger, rx_logger) = mpsc::channel(); + + tx_logger.send(logger.clone()).unwrap(); + + let handle = thread::spawn(move || { + let logger = rx_logger.recv().unwrap(); + + // write oci state to child + let env: HashMap = envs + .iter() + .map(|e| { + let v: Vec<&str> = e.split('=').collect(); + (v[0].to_string(), v[1].to_string()) + }) + .collect(); + + let mut child = Command::new(path.to_str().unwrap()) + .args(args.iter()) + .envs(env.iter()) + .stdin(Stdio::piped()) + .stdout(Stdio::piped()) + .stderr(Stdio::piped()) + .spawn() + .unwrap(); + + //send out our pid + tx.send(child.id() as libc::pid_t).unwrap(); + info!(logger, "hook grand: {}", child.id()); + + child + .stdin + .as_mut() + .unwrap() + .write_all(state.as_bytes()) + .unwrap(); + + // read something from stdout for debug + let mut out = String::new(); + child + .stdout + .as_mut() + .unwrap() + .read_to_string(&mut out) + .unwrap(); + info!(logger, "{}", out.as_str()); + match child.wait() { + Ok(exit) => { + let code: i32 = if exit.success() { + 0 + } else { + match exit.code() { + Some(c) => (c as u32 | 0x80000000) as i32, + None => exit.signal().unwrap(), + } + }; + + tx.send(code).unwrap(); + } + + Err(e) => { + info!( + logger, + "wait child error: {} {}", + e.description(), + e.raw_os_error().unwrap() + ); + + // There is apparently race between this wait and + // child reaper. Ie, the child can already + // be reaped by subreaper, child.wait returns + // ECHILD. I have no idea how to get the + // correct exit status here at present, + // just pretend it exits successfully. + // -- FIXME + // just in case. Should not happen any more + + tx.send(0).unwrap(); + } + } + }); + + let pid = rx.recv().unwrap(); + info!(logger, "hook grand: {}", pid); + + let status: i32 = if h.Timeout > 0 { + match rx.recv_timeout(Duration::from_secs(h.Timeout as u64)) { + Ok(s) => s, + Err(e) => { + let error = if e == RecvTimeoutError::Timeout { + -libc::ETIMEDOUT + } else { + -libc::EPIPE + }; + let _ = signal::kill(Pid::from_raw(pid), Some(Signal::SIGKILL)); + error + } + } + } else { + if let Ok(s) = rx.recv() { + s + } else { + let _ = signal::kill(Pid::from_raw(pid), Some(Signal::SIGKILL)); + -libc::EPIPE + } + }; + + handle.join().unwrap(); + let _ = write_sync(wfd, status); + // let _ = wait::waitpid(Pid::from_raw(pid), + // Some(WaitPidFlag::WEXITED | WaitPidFlag::__WALL)); + std::process::exit(0); + } + } +} diff --git a/src/agent/rustjail/src/errors.rs b/src/agent/rustjail/src/errors.rs new file mode 100644 index 0000000000..130f610e16 --- /dev/null +++ b/src/agent/rustjail/src/errors.rs @@ -0,0 +1,32 @@ +// Copyright (c) 2019 Ant Financial +// +// SPDX-License-Identifier: Apache-2.0 +// + +// define errors here + +error_chain! { + types { + Error, ErrorKind, ResultExt, Result; + } + // foreign error conv to chain error + foreign_links { + Io(std::io::Error); + Nix(nix::Error); + Ffi(std::ffi::NulError); + Caps(caps::errors::Error); + Serde(serde_json::Error); + UTF8(std::string::FromUtf8Error); + Parse(std::num::ParseIntError); + Scanfmt(scan_fmt::parse::ScanError); + Ip(std::net::AddrParseError); + Regex(regex::Error); + } + // define new errors + errors { + ErrorCode(t: String) { + description("Error Code") + display("Error Code: '{}'", t) + } + } +} diff --git a/src/agent/rustjail/src/lib.rs b/src/agent/rustjail/src/lib.rs new file mode 100644 index 0000000000..6bfc3d9b63 --- /dev/null +++ b/src/agent/rustjail/src/lib.rs @@ -0,0 +1,586 @@ +// Copyright (c) 2019 Ant Financial +// +// SPDX-License-Identifier: Apache-2.0 +// + +// #![allow(unused_attributes)] +// #![allow(unused_imports)] +// #![allow(unused_variables)] +// #![allow(unused_mut)] +#![allow(dead_code)] +// #![allow(deprecated)] +// #![allow(unused_must_use)] +#![allow(non_upper_case_globals)] +// #![allow(unused_comparisons)] +#[macro_use] +extern crate error_chain; +extern crate serde; +extern crate serde_json; +#[macro_use] +extern crate serde_derive; +extern crate caps; +extern crate protocols; +#[macro_use] +extern crate scopeguard; +extern crate prctl; +#[macro_use] +extern crate lazy_static; +extern crate libc; +extern crate protobuf; +#[macro_use] +extern crate slog; +#[macro_use] +extern crate scan_fmt; +extern crate oci; +extern crate path_absolutize; +extern crate regex; + +// Convenience macro to obtain the scope logger +macro_rules! sl { + () => { + slog_scope::logger().new(o!("subsystem" => "rustjail")) + }; +} + +pub mod cgroups; +pub mod container; +pub mod errors; +pub mod mount; +pub mod process; +pub mod specconv; +// pub mod sync; +pub mod capabilities; +pub mod validator; + +// pub mod factory; +//pub mod configs; +// pub mod devices; +// pub mod init; +// pub mod rootfs; +// pub mod capabilities; +// pub mod console; +// pub mod stats; +// pub mod user; +//pub mod intelrdt; + +// construtc ociSpec from grpcSpec, which is needed for hook +// execution. since hooks read config.json + +use std::collections::HashMap; +use std::mem::MaybeUninit; + +use oci::{ + Box as ociBox, Hooks as ociHooks, Linux as ociLinux, LinuxCapabilities as ociLinuxCapabilities, + Mount as ociMount, POSIXRlimit as ociPOSIXRlimit, Process as ociProcess, Root as ociRoot, + Spec as ociSpec, User as ociUser, +}; +use protocols::oci::{ + Hooks as grpcHooks, Linux as grpcLinux, Mount as grpcMount, Process as grpcProcess, + Root as grpcRoot, Spec as grpcSpec, +}; + +fn process_grpc_to_oci(p: &grpcProcess) -> ociProcess { + let console_size = if p.ConsoleSize.is_some() { + let c = p.ConsoleSize.as_ref().unwrap(); + Some(ociBox { + height: c.Height, + width: c.Width, + }) + } else { + None + }; + + let user = if p.User.is_some() { + let u = p.User.as_ref().unwrap(); + ociUser { + uid: u.UID, + gid: u.GID, + additional_gids: u.AdditionalGids.clone(), + username: u.Username.clone(), + } + } else { + unsafe { MaybeUninit::zeroed().assume_init() } + }; + + let capabilities = if p.Capabilities.is_some() { + let cap = p.Capabilities.as_ref().unwrap(); + + Some(ociLinuxCapabilities { + bounding: cap.Bounding.clone().into_vec(), + effective: cap.Effective.clone().into_vec(), + inheritable: cap.Inheritable.clone().into_vec(), + permitted: cap.Permitted.clone().into_vec(), + ambient: cap.Ambient.clone().into_vec(), + }) + } else { + None + }; + + let rlimits = { + let mut r = Vec::new(); + for lm in p.Rlimits.iter() { + r.push(ociPOSIXRlimit { + r#type: lm.Type.clone(), + hard: lm.Hard, + soft: lm.Soft, + }); + } + r + }; + + ociProcess { + terminal: p.Terminal, + console_size, + user, + args: p.Args.clone().into_vec(), + env: p.Env.clone().into_vec(), + cwd: p.Cwd.clone(), + capabilities, + rlimits, + no_new_privileges: p.NoNewPrivileges, + apparmor_profile: p.ApparmorProfile.clone(), + oom_score_adj: Some(p.OOMScoreAdj as i32), + selinux_label: p.SelinuxLabel.clone(), + } +} + +fn process_oci_to_grpc(_p: ociProcess) -> grpcProcess { + // dont implement it for now + unsafe { MaybeUninit::zeroed().assume_init() } +} + +fn root_grpc_to_oci(root: &grpcRoot) -> ociRoot { + ociRoot { + path: root.Path.clone(), + readonly: root.Readonly, + } +} + +fn root_oci_to_grpc(_root: &ociRoot) -> grpcRoot { + unsafe { MaybeUninit::zeroed().assume_init() } +} + +fn mount_grpc_to_oci(m: &grpcMount) -> ociMount { + ociMount { + destination: m.destination.clone(), + r#type: m.field_type.clone(), + source: m.source.clone(), + options: m.options.clone().into_vec(), + } +} + +fn mount_oci_to_grpc(_m: &ociMount) -> grpcMount { + unsafe { MaybeUninit::zeroed().assume_init() } +} + +use oci::Hook as ociHook; +use protocols::oci::Hook as grpcHook; + +fn hook_grpc_to_oci(h: &[grpcHook]) -> Vec { + let mut r = Vec::new(); + for e in h.iter() { + r.push(ociHook { + path: e.Path.clone(), + args: e.Args.clone().into_vec(), + env: e.Env.clone().into_vec(), + timeout: Some(e.Timeout as i32), + }); + } + r +} + +fn hooks_grpc_to_oci(h: &grpcHooks) -> ociHooks { + let prestart = hook_grpc_to_oci(h.Prestart.as_ref()); + + let poststart = hook_grpc_to_oci(h.Poststart.as_ref()); + + let poststop = hook_grpc_to_oci(h.Poststop.as_ref()); + + ociHooks { + prestart, + poststart, + poststop, + } +} + +fn hooks_oci_to_grpc(_h: &ociHooks) -> grpcHooks { + unsafe { MaybeUninit::zeroed().assume_init() } +} + +use oci::{ + LinuxDevice as ociLinuxDevice, LinuxIDMapping as ociLinuxIDMapping, + LinuxIntelRdt as ociLinuxIntelRdt, LinuxNamespace as ociLinuxNamespace, + LinuxResources as ociLinuxResources, LinuxSeccomp as ociLinuxSeccomp, +}; +use protocols::oci::{ + LinuxIDMapping as grpcLinuxIDMapping, LinuxResources as grpcLinuxResources, + LinuxSeccomp as grpcLinuxSeccomp, +}; + +fn idmap_grpc_to_oci(im: &grpcLinuxIDMapping) -> ociLinuxIDMapping { + ociLinuxIDMapping { + container_id: im.ContainerID, + host_id: im.HostID, + size: im.Size, + } +} + +fn idmaps_grpc_to_oci(ims: &[grpcLinuxIDMapping]) -> Vec { + let mut r = Vec::new(); + for im in ims.iter() { + r.push(idmap_grpc_to_oci(im)); + } + r +} + +use oci::{ + LinuxBlockIO as ociLinuxBlockIO, LinuxBlockIODevice as ociLinuxBlockIODevice, + LinuxCPU as ociLinuxCPU, LinuxDeviceCgroup as ociLinuxDeviceCgroup, + LinuxHugepageLimit as ociLinuxHugepageLimit, + LinuxInterfacePriority as ociLinuxInterfacePriority, LinuxMemory as ociLinuxMemory, + LinuxNetwork as ociLinuxNetwork, LinuxPids as ociLinuxPids, + LinuxThrottleDevice as ociLinuxThrottleDevice, LinuxWeightDevice as ociLinuxWeightDevice, +}; +use protocols::oci::{ + LinuxBlockIO as grpcLinuxBlockIO, LinuxThrottleDevice as grpcLinuxThrottleDevice, + LinuxWeightDevice as grpcLinuxWeightDevice, +}; + +fn throttle_devices_grpc_to_oci(tds: &[grpcLinuxThrottleDevice]) -> Vec { + let mut r = Vec::new(); + for td in tds.iter() { + r.push(ociLinuxThrottleDevice { + blk: ociLinuxBlockIODevice { + major: td.Major, + minor: td.Minor, + }, + rate: td.Rate, + }); + } + r +} + +fn weight_devices_grpc_to_oci(wds: &[grpcLinuxWeightDevice]) -> Vec { + let mut r = Vec::new(); + for wd in wds.iter() { + r.push(ociLinuxWeightDevice { + blk: ociLinuxBlockIODevice { + major: wd.Major, + minor: wd.Minor, + }, + weight: Some(wd.Weight as u16), + leaf_weight: Some(wd.LeafWeight as u16), + }); + } + r +} + +fn blockio_grpc_to_oci(blk: &grpcLinuxBlockIO) -> ociLinuxBlockIO { + let weight_device = weight_devices_grpc_to_oci(blk.WeightDevice.as_ref()); + let throttle_read_bps_device = throttle_devices_grpc_to_oci(blk.ThrottleReadBpsDevice.as_ref()); + let throttle_write_bps_device = + throttle_devices_grpc_to_oci(blk.ThrottleWriteBpsDevice.as_ref()); + let throttle_read_iops_device = + throttle_devices_grpc_to_oci(blk.ThrottleReadIOPSDevice.as_ref()); + let throttle_write_iops_device = + throttle_devices_grpc_to_oci(blk.ThrottleWriteIOPSDevice.as_ref()); + + ociLinuxBlockIO { + weight: Some(blk.Weight as u16), + leaf_weight: Some(blk.LeafWeight as u16), + weight_device, + throttle_read_bps_device, + throttle_write_bps_device, + throttle_read_iops_device, + throttle_write_iops_device, + } +} + +fn resources_grpc_to_oci(res: &grpcLinuxResources) -> ociLinuxResources { + let devices = { + let mut d = Vec::new(); + for dev in res.Devices.iter() { + let major = if dev.Major == -1 { + None + } else { + Some(dev.Major) + }; + + let minor = if dev.Minor == -1 { + None + } else { + Some(dev.Minor) + }; + d.push(ociLinuxDeviceCgroup { + allow: dev.Allow, + r#type: dev.Type.clone(), + major, + minor, + access: dev.Access.clone(), + }); + } + d + }; + + let memory = if res.Memory.is_some() { + let mem = res.Memory.as_ref().unwrap(); + Some(ociLinuxMemory { + limit: Some(mem.Limit), + reservation: Some(mem.Reservation), + swap: Some(mem.Swap), + kernel: Some(mem.Kernel), + kernel_tcp: Some(mem.KernelTCP), + swapiness: Some(mem.Swappiness as i64), + disable_oom_killer: Some(mem.DisableOOMKiller), + }) + } else { + None + }; + + let cpu = if res.CPU.is_some() { + let c = res.CPU.as_ref().unwrap(); + Some(ociLinuxCPU { + shares: Some(c.Shares), + quota: Some(c.Quota), + period: Some(c.Period), + realtime_runtime: Some(c.RealtimeRuntime), + realtime_period: Some(c.RealtimePeriod), + cpus: c.Cpus.clone(), + mems: c.Mems.clone(), + }) + } else { + None + }; + + let pids = if res.Pids.is_some() { + let p = res.Pids.as_ref().unwrap(); + Some(ociLinuxPids { limit: p.Limit }) + } else { + None + }; + + let block_io = if res.BlockIO.is_some() { + let blk = res.BlockIO.as_ref().unwrap(); + // copy LinuxBlockIO + Some(blockio_grpc_to_oci(blk)) + } else { + None + }; + + let hugepage_limits = { + let mut r = Vec::new(); + for hl in res.HugepageLimits.iter() { + r.push(ociLinuxHugepageLimit { + page_size: hl.Pagesize.clone(), + limit: hl.Limit, + }); + } + r + }; + + let network = if res.Network.is_some() { + let net = res.Network.as_ref().unwrap(); + let priorities = { + let mut r = Vec::new(); + for pr in net.Priorities.iter() { + r.push(ociLinuxInterfacePriority { + name: pr.Name.clone(), + priority: pr.Priority, + }); + } + r + }; + Some(ociLinuxNetwork { + class_id: Some(net.ClassID), + priorities, + }) + } else { + None + }; + + ociLinuxResources { + devices, + memory, + cpu, + pids, + block_io, + hugepage_limits, + network, + rdma: HashMap::new(), + } +} + +use oci::{LinuxSeccompArg as ociLinuxSeccompArg, LinuxSyscall as ociLinuxSyscall}; + +fn seccomp_grpc_to_oci(sec: &grpcLinuxSeccomp) -> ociLinuxSeccomp { + let syscalls = { + let mut r = Vec::new(); + + for sys in sec.Syscalls.iter() { + let mut args = Vec::new(); + + for arg in sys.Args.iter() { + args.push(ociLinuxSeccompArg { + index: arg.Index as u32, + value: arg.Value, + value_two: arg.ValueTwo, + op: arg.Op.clone(), + }); + } + + r.push(ociLinuxSyscall { + names: sys.Names.clone().into_vec(), + action: sys.Action.clone(), + args, + }); + } + r + }; + + ociLinuxSeccomp { + default_action: sec.DefaultAction.clone(), + architectures: sec.Architectures.clone().into_vec(), + syscalls, + } +} + +fn linux_grpc_to_oci(l: &grpcLinux) -> ociLinux { + let uid_mappings = idmaps_grpc_to_oci(l.UIDMappings.as_ref()); + let gid_mappings = idmaps_grpc_to_oci(l.GIDMappings.as_ref()); + + let resources = if l.Resources.is_some() { + Some(resources_grpc_to_oci(l.Resources.as_ref().unwrap())) + } else { + None + }; + + let seccomp = if l.Seccomp.is_some() { + Some(seccomp_grpc_to_oci(l.Seccomp.as_ref().unwrap())) + } else { + None + }; + + let namespaces = { + let mut r = Vec::new(); + + for ns in l.Namespaces.iter() { + r.push(ociLinuxNamespace { + r#type: ns.Type.clone(), + path: ns.Path.clone(), + }); + } + r + }; + + let devices = { + let mut r = Vec::new(); + + for d in l.Devices.iter() { + r.push(ociLinuxDevice { + path: d.Path.clone(), + r#type: d.Type.clone(), + major: d.Major, + minor: d.Minor, + file_mode: Some(d.FileMode), + uid: Some(d.UID), + gid: Some(d.GID), + }); + } + r + }; + + let intel_rdt = if l.IntelRdt.is_some() { + let rdt = l.IntelRdt.as_ref().unwrap(); + + Some(ociLinuxIntelRdt { + l3_cache_schema: rdt.L3CacheSchema.clone(), + }) + } else { + None + }; + + ociLinux { + uid_mappings, + gid_mappings, + sysctl: l.Sysctl.clone(), + resources, + cgroups_path: l.CgroupsPath.clone(), + namespaces, + devices, + seccomp, + rootfs_propagation: l.RootfsPropagation.clone(), + masked_paths: l.MaskedPaths.clone().into_vec(), + readonly_paths: l.ReadonlyPaths.clone().into_vec(), + mount_label: l.MountLabel.clone(), + intel_rdt, + } +} + +fn linux_oci_to_grpc(_l: &ociLinux) -> grpcLinux { + grpcLinux::default() +} + +pub fn grpc_to_oci(grpc: &grpcSpec) -> ociSpec { + // process + let process = if grpc.Process.is_some() { + Some(process_grpc_to_oci(grpc.Process.as_ref().unwrap())) + } else { + None + }; + + // root + let root = if grpc.Root.is_some() { + Some(root_grpc_to_oci(grpc.Root.as_ref().unwrap())) + } else { + None + }; + + // mounts + let mounts = { + let mut r = Vec::new(); + for m in grpc.Mounts.iter() { + r.push(mount_grpc_to_oci(m)); + } + r + }; + + // hooks + let hooks = if grpc.Hooks.is_some() { + Some(hooks_grpc_to_oci(grpc.Hooks.as_ref().unwrap())) + } else { + None + }; + + // Linux + let linux = if grpc.Linux.is_some() { + Some(linux_grpc_to_oci(grpc.Linux.as_ref().unwrap())) + } else { + None + }; + + ociSpec { + version: grpc.Version.clone(), + process, + root, + hostname: grpc.Hostname.clone(), + mounts, + hooks, + annotations: grpc.Annotations.clone(), + linux, + solaris: None, + windows: None, + vm: None, + } +} + +pub fn oci_to_grpc(_oci: &ociSpec) -> grpcSpec { + unsafe { MaybeUninit::zeroed().assume_init() } +} + +#[cfg(test)] +mod tests { + #[test] + fn it_works() { + assert_eq!(2 + 2, 4); + } +} diff --git a/src/agent/rustjail/src/mount.rs b/src/agent/rustjail/src/mount.rs new file mode 100644 index 0000000000..d4dedc3a56 --- /dev/null +++ b/src/agent/rustjail/src/mount.rs @@ -0,0 +1,738 @@ +// Copyright (c) 2019 Ant Financial +// +// SPDX-License-Identifier: Apache-2.0 +// + +use libc::uid_t; +use nix::errno::Errno; +use nix::fcntl::{self, OFlag}; +use nix::mount::{self, MntFlags, MsFlags}; +use nix::sys::stat::{self, Mode, SFlag}; +use nix::unistd::{self, Gid, Uid}; +use nix::NixPath; +use protocols::oci::{LinuxDevice, Mount, Spec}; +use std::collections::{HashMap, HashSet}; +use std::fs::{self, OpenOptions}; +use std::os::unix; +use std::path::{Path, PathBuf}; + +use path_absolutize::*; +use scan_fmt; +use std::fs::File; +use std::io::{BufRead, BufReader}; + +use crate::container::DEFAULT_DEVICES; +use crate::errors::*; +use lazy_static; +use std::string::ToString; + +use protobuf::{CachedSize, RepeatedField, UnknownFields}; +use slog::Logger; + +// Info reveals information about a particular mounted filesystem. This +// struct is populated from the content in the /proc//mountinfo file. +pub struct Info { + id: i32, + parent: i32, + major: i32, + minor: i32, + root: String, + mount_point: String, + opts: String, + optional: String, + fstype: String, + source: String, + vfs_opts: String, +} + +const MOUNTINFOFORMAT: &'static str = "{d} {d} {d}:{d} {} {} {} {}"; + +lazy_static! { + static ref PROPAGATION: HashMap<&'static str, MsFlags> = { + let mut m = HashMap::new(); + m.insert("shared", MsFlags::MS_SHARED | MsFlags::MS_REC); + m.insert("private", MsFlags::MS_PRIVATE | MsFlags::MS_REC); + m.insert("slave", MsFlags::MS_SLAVE | MsFlags::MS_REC); + m + }; + static ref OPTIONS: HashMap<&'static str, (bool, MsFlags)> = { + let mut m = HashMap::new(); + m.insert("defaults", (false, MsFlags::empty())); + m.insert("ro", (false, MsFlags::MS_RDONLY)); + m.insert("rw", (true, MsFlags::MS_RDONLY)); + m.insert("suid", (true, MsFlags::MS_NOSUID)); + m.insert("nosuid", (false, MsFlags::MS_NOSUID)); + m.insert("dev", (true, MsFlags::MS_NODEV)); + m.insert("nodev", (false, MsFlags::MS_NODEV)); + m.insert("exec", (true, MsFlags::MS_NOEXEC)); + m.insert("noexec", (false, MsFlags::MS_NOEXEC)); + m.insert("sync", (false, MsFlags::MS_SYNCHRONOUS)); + m.insert("async", (true, MsFlags::MS_SYNCHRONOUS)); + m.insert("dirsync", (false, MsFlags::MS_DIRSYNC)); + m.insert("remount", (false, MsFlags::MS_REMOUNT)); + m.insert("mand", (false, MsFlags::MS_MANDLOCK)); + m.insert("nomand", (true, MsFlags::MS_MANDLOCK)); + m.insert("atime", (true, MsFlags::MS_NOATIME)); + m.insert("noatime", (false, MsFlags::MS_NOATIME)); + m.insert("diratime", (true, MsFlags::MS_NODIRATIME)); + m.insert("nodiratime", (false, MsFlags::MS_NODIRATIME)); + m.insert("bind", (false, MsFlags::MS_BIND)); + m.insert("rbind", (false, MsFlags::MS_BIND | MsFlags::MS_REC)); + m.insert("unbindable", (false, MsFlags::MS_UNBINDABLE)); + m.insert( + "runbindable", + (false, MsFlags::MS_UNBINDABLE | MsFlags::MS_REC), + ); + m.insert("private", (false, MsFlags::MS_PRIVATE)); + m.insert("rprivate", (false, MsFlags::MS_PRIVATE | MsFlags::MS_REC)); + m.insert("shared", (false, MsFlags::MS_SHARED)); + m.insert("rshared", (false, MsFlags::MS_SHARED | MsFlags::MS_REC)); + m.insert("slave", (false, MsFlags::MS_SLAVE)); + m.insert("rslave", (false, MsFlags::MS_SLAVE | MsFlags::MS_REC)); + m.insert("relatime", (false, MsFlags::MS_RELATIME)); + m.insert("norelatime", (true, MsFlags::MS_RELATIME)); + m.insert("strictatime", (false, MsFlags::MS_STRICTATIME)); + m.insert("nostrictatime", (true, MsFlags::MS_STRICTATIME)); + m + }; +} + +pub fn init_rootfs( + logger: &Logger, + spec: &Spec, + cpath: &HashMap, + mounts: &HashMap, + bind_device: bool, +) -> Result<()> { + lazy_static::initialize(&OPTIONS); + lazy_static::initialize(&PROPAGATION); + lazy_static::initialize(&LINUXDEVICETYPE); + + let linux = spec.Linux.as_ref().unwrap(); + let mut flags = MsFlags::MS_REC; + match PROPAGATION.get(&linux.RootfsPropagation.as_str()) { + Some(fl) => flags |= *fl, + None => flags |= MsFlags::MS_SLAVE, + } + + let rootfs = spec.Root.as_ref().unwrap().Path.as_str(); + let root = fs::canonicalize(rootfs)?; + let rootfs = root.to_str().unwrap(); + + mount::mount(None::<&str>, "/", None::<&str>, flags, None::<&str>)?; + mount::mount( + Some(rootfs), + rootfs, + None::<&str>, + MsFlags::MS_BIND | MsFlags::MS_REC, + None::<&str>, + )?; + + for m in &spec.Mounts { + let (mut flags, data) = parse_mount(&m); + if !m.destination.starts_with("/") || m.destination.contains("..") { + return Err(ErrorKind::Nix(nix::Error::Sys(Errno::EINVAL)).into()); + } + if m.field_type == "cgroup" { + mount_cgroups(logger, m, rootfs, flags, &data, cpath, mounts)?; + } else { + if m.destination == "/dev" { + flags &= !MsFlags::MS_RDONLY; + } + + mount_from(&m, &rootfs, flags, &data, "")?; + } + } + + let olddir = unistd::getcwd()?; + unistd::chdir(rootfs)?; + + default_symlinks()?; + create_devices(&linux.Devices, bind_device)?; + ensure_ptmx()?; + + unistd::chdir(&olddir)?; + + Ok(()) +} + +fn mount_cgroups( + logger: &Logger, + m: &Mount, + rootfs: &str, + flags: MsFlags, + _data: &str, + cpath: &HashMap, + mounts: &HashMap, +) -> Result<()> { + // mount tmpfs + let ctm = Mount { + source: "tmpfs".to_string(), + field_type: "tmpfs".to_string(), + destination: m.destination.clone(), + options: RepeatedField::default(), + unknown_fields: UnknownFields::default(), + cached_size: CachedSize::default(), + }; + + let cflags = MsFlags::MS_NOEXEC | MsFlags::MS_NOSUID | MsFlags::MS_NODEV; + info!(logger, "tmpfs"); + mount_from(&ctm, rootfs, cflags, "", "")?; + let olddir = unistd::getcwd()?; + + unistd::chdir(rootfs)?; + + let mut srcs: HashSet = HashSet::new(); + + // bind mount cgroups + for (key, mount) in mounts.iter() { + info!(logger, "{}", key); + let source = if cpath.get(key).is_some() { + cpath.get(key).unwrap() + } else { + continue; + }; + + let base = if let Some(o) = mount.rfind('/') { + &mount[o + 1..] + } else { + &mount[..] + }; + + let destination = format!("{}/{}", m.destination.as_str(), base); + + if srcs.contains(source) { + // already mounted, xxx,yyy style cgroup + if key != base { + let src = format!("{}/{}", m.destination.as_str(), key); + unix::fs::symlink(destination.as_str(), &src[1..])?; + } + + continue; + } + + srcs.insert(source.to_string()); + + info!(logger, "{}", destination.as_str()); + + let bm = Mount { + source: source.to_string(), + field_type: "bind".to_string(), + destination: destination.clone(), + options: RepeatedField::default(), + unknown_fields: UnknownFields::default(), + cached_size: CachedSize::default(), + }; + + mount_from( + &bm, + rootfs, + flags | MsFlags::MS_REC | MsFlags::MS_BIND, + "", + "", + )?; + + if key != base { + let src = format!("{}/{}", m.destination.as_str(), key); + match unix::fs::symlink(destination.as_str(), &src[1..]) { + Err(e) => { + info!( + logger, + "symlink: {} {} err: {}", + key, + destination.as_str(), + e.to_string() + ); + return Err(e.into()); + } + Ok(_) => {} + } + } + } + + unistd::chdir(&olddir)?; + + if flags.contains(MsFlags::MS_RDONLY) { + let dest = format!("{}{}", rootfs, m.destination.as_str()); + mount::mount( + Some(dest.as_str()), + dest.as_str(), + None::<&str>, + flags | MsFlags::MS_BIND | MsFlags::MS_REMOUNT, + None::<&str>, + )?; + } + + Ok(()) +} + +pub fn pivot_rootfs(path: &P) -> Result<()> { + let oldroot = fcntl::open("/", OFlag::O_DIRECTORY | OFlag::O_RDONLY, Mode::empty())?; + defer!(unistd::close(oldroot).unwrap()); + let newroot = fcntl::open(path, OFlag::O_DIRECTORY | OFlag::O_RDONLY, Mode::empty())?; + defer!(unistd::close(newroot).unwrap()); + unistd::pivot_root(path, path)?; + mount::umount2("/", MntFlags::MNT_DETACH)?; + unistd::fchdir(newroot)?; + stat::umask(Mode::from_bits_truncate(0o022)); + Ok(()) +} + +// Parse /proc/self/mountinfo because comparing Dev and ino does not work from +// bind mounts +fn parse_mount_table() -> Result> { + let file = File::open("/proc/self/mountinfo")?; + let reader = BufReader::new(file); + let mut infos = Vec::new(); + + for (_index, line) in reader.lines().enumerate() { + let line = line?; + + let (id, parent, major, minor, root, mount_point, opts, optional) = scan_fmt!( + &line, + MOUNTINFOFORMAT, + i32, + i32, + i32, + i32, + String, + String, + String, + String + )?; + + let fields: Vec<&str> = line.split(" - ").collect(); + if fields.len() == 2 { + let (fstype, source, vfs_opts) = + scan_fmt!(fields[1], "{} {} {}", String, String, String)?; + + let mut optional_new = String::new(); + if optional != "-" { + optional_new = optional; + } + + let info = Info { + id, + parent, + major, + minor, + root, + mount_point, + opts, + optional: optional_new, + fstype, + source, + vfs_opts, + }; + + infos.push(info); + } else { + return Err(ErrorKind::ErrorCode("failed to parse mount info file".to_string()).into()); + } + } + + Ok(infos) +} + +pub fn ms_move_root(rootfs: &str) -> Result { + unistd::chdir(rootfs)?; + let mount_infos = parse_mount_table()?; + + let root_path = Path::new(rootfs); + let abs_root_buf = root_path.absolutize()?; + let abs_root = abs_root_buf.to_str().ok_or::( + ErrorKind::ErrorCode(format!("failed to parse {} to absolute path", rootfs)).into(), + )?; + + for info in mount_infos.iter() { + let mount_point = Path::new(&info.mount_point); + let abs_mount_buf = mount_point.absolutize()?; + let abs_mount_point = abs_mount_buf.to_str().ok_or::( + ErrorKind::ErrorCode(format!( + "failed to parse {} to absolute path", + info.mount_point + )) + .into(), + )?; + let abs_mount_point_string = String::from(abs_mount_point); + + // Umount every syfs and proc file systems, except those under the container rootfs + if (info.fstype != "proc" && info.fstype != "sysfs") + || abs_mount_point_string.starts_with(abs_root) + { + continue; + } + + // Be sure umount events are not propagated to the host. + mount::mount( + None::<&str>, + abs_mount_point, + None::<&str>, + MsFlags::MS_SLAVE | MsFlags::MS_REC, + None::<&str>, + )?; + match mount::umount2(abs_mount_point, MntFlags::MNT_DETACH) { + Ok(_) => (), + Err(e) => { + if e.ne(&nix::Error::from(Errno::EINVAL)) && e.ne(&nix::Error::from(Errno::EPERM)) { + return Err(ErrorKind::ErrorCode(e.to_string()).into()); + } + + // If we have not privileges for umounting (e.g. rootless), then + // cover the path. + mount::mount( + Some("tmpfs"), + abs_mount_point, + Some("tmpfs"), + MsFlags::empty(), + None::<&str>, + )?; + } + } + } + + mount::mount( + Some(abs_root), + "/", + None::<&str>, + MsFlags::MS_MOVE, + None::<&str>, + )?; + unistd::chroot(".")?; + unistd::chdir("/")?; + + Ok(true) +} + +fn parse_mount(m: &Mount) -> (MsFlags, String) { + let mut flags = MsFlags::empty(); + let mut data = Vec::new(); + + for o in &m.options { + match OPTIONS.get(o.as_str()) { + Some(v) => { + let (clear, fl) = *v; + if clear { + flags &= !fl; + } else { + flags |= fl; + } + } + + None => data.push(o.clone()), + } + } + + (flags, data.join(",")) +} + +fn mount_from(m: &Mount, rootfs: &str, flags: MsFlags, data: &str, _label: &str) -> Result<()> { + let d = String::from(data); + let dest = format!("{}{}", rootfs, &m.destination); + + let src = if m.field_type.as_str() == "bind" { + let src = fs::canonicalize(m.source.as_str())?; + let dir = if src.is_file() { + Path::new(&dest).parent().unwrap() + } else { + Path::new(&dest) + }; + + // let _ = fs::create_dir_all(&dir); + match fs::create_dir_all(&dir) { + Ok(_) => {} + Err(e) => { + info!( + sl!(), + "creat dir {}: {}", + dir.to_str().unwrap(), + e.to_string() + ); + } + } + + // make sure file exists so we can bind over it + if src.is_file() { + let _ = OpenOptions::new().create(true).write(true).open(&dest); + } + src + } else { + let _ = fs::create_dir_all(&dest); + PathBuf::from(&m.source) + }; + + info!(sl!(), "{}, {}", src.to_str().unwrap(), dest.as_str()); + + // ignore this check since some mount's src didn't been a directory + // such as tmpfs. + /* + match stat::stat(src.to_str().unwrap()) { + Ok(_) => {} + Err(e) => { + info!("{}: {}", src.to_str().unwrap(), e.as_errno().unwrap().desc()); + } + } + */ + + match stat::stat(dest.as_str()) { + Ok(_) => {} + Err(e) => { + info!(sl!(), "{}: {}", dest.as_str(), e.as_errno().unwrap().desc()); + } + } + + match mount::mount( + Some(src.to_str().unwrap()), + dest.as_str(), + Some(m.field_type.as_str()), + flags, + Some(d.as_str()), + ) { + Ok(_) => {} + Err(e) => { + info!(sl!(), "mount error: {}", e.as_errno().unwrap().desc()); + return Err(e.into()); + } + } + + if flags.contains(MsFlags::MS_BIND) + && flags.intersects( + !(MsFlags::MS_REC + | MsFlags::MS_REMOUNT + | MsFlags::MS_BIND + | MsFlags::MS_PRIVATE + | MsFlags::MS_SHARED + | MsFlags::MS_SLAVE), + ) + { + match mount::mount( + Some(dest.as_str()), + dest.as_str(), + None::<&str>, + flags | MsFlags::MS_REMOUNT, + None::<&str>, + ) { + Err(e) => { + info!( + sl!(), + "remout {}: {}", + dest.as_str(), + e.as_errno().unwrap().desc() + ); + return Err(e.into()); + } + Ok(_) => {} + } + } + Ok(()) +} + +static SYMLINKS: &'static [(&'static str, &'static str)] = &[ + ("/proc/self/fd", "dev/fd"), + ("/proc/self/fd/0", "dev/stdin"), + ("/proc/self/fd/1", "dev/stdout"), + ("/proc/self/fd/2", "dev/stderr"), +]; + +fn default_symlinks() -> Result<()> { + if Path::new("/proc/kcore").exists() { + unix::fs::symlink("/proc/kcore", "dev/kcore")?; + } + for &(src, dst) in SYMLINKS { + unix::fs::symlink(src, dst)?; + } + Ok(()) +} +fn create_devices(devices: &[LinuxDevice], bind: bool) -> Result<()> { + let op: fn(&LinuxDevice) -> Result<()> = if bind { bind_dev } else { mknod_dev }; + let old = stat::umask(Mode::from_bits_truncate(0o000)); + for dev in DEFAULT_DEVICES.iter() { + op(dev)?; + } + for dev in devices { + if !dev.Path.starts_with("/dev") || dev.Path.contains("..") { + let msg = format!("{} is not a valid device path", dev.Path); + bail!(ErrorKind::ErrorCode(msg)); + } + op(dev)?; + } + stat::umask(old); + Ok(()) +} + +fn ensure_ptmx() -> Result<()> { + let _ = fs::remove_file("dev/ptmx"); + unix::fs::symlink("pts/ptmx", "dev/ptmx")?; + Ok(()) +} + +fn makedev(major: u64, minor: u64) -> u64 { + (minor & 0xff) | ((major & 0xfff) << 8) | ((minor & !0xff) << 12) | ((major & !0xfff) << 32) +} + +lazy_static! { + static ref LINUXDEVICETYPE: HashMap<&'static str, SFlag> = { + let mut m = HashMap::new(); + m.insert("c", SFlag::S_IFCHR); + m.insert("b", SFlag::S_IFBLK); + m.insert("p", SFlag::S_IFIFO); + m + }; +} + +fn mknod_dev(dev: &LinuxDevice) -> Result<()> { + let f = match LINUXDEVICETYPE.get(dev.Type.as_str()) { + Some(v) => v, + None => return Err(ErrorKind::ErrorCode("invalid spec".to_string()).into()), + }; + + stat::mknod( + &dev.Path[1..], + *f, + Mode::from_bits_truncate(dev.FileMode), + makedev(dev.Major as u64, dev.Minor as u64), + )?; + + unistd::chown( + &dev.Path[1..], + Some(Uid::from_raw(dev.UID as uid_t)), + Some(Gid::from_raw(dev.GID as uid_t)), + )?; + + Ok(()) +} + +fn bind_dev(dev: &LinuxDevice) -> Result<()> { + let fd = fcntl::open( + &dev.Path[1..], + OFlag::O_RDWR | OFlag::O_CREAT, + Mode::from_bits_truncate(0o644), + )?; + + unistd::close(fd)?; + + mount::mount( + Some(&*dev.Path), + &dev.Path[1..], + None::<&str>, + MsFlags::MS_BIND, + None::<&str>, + )?; + Ok(()) +} + +pub fn finish_rootfs(spec: &Spec) -> Result<()> { + let olddir = unistd::getcwd()?; + info!(sl!(), "{}", olddir.to_str().unwrap()); + unistd::chdir("/")?; + if spec.Linux.is_some() { + let linux = spec.Linux.as_ref().unwrap(); + + for path in linux.MaskedPaths.iter() { + mask_path(path)?; + } + + for path in linux.ReadonlyPaths.iter() { + readonly_path(path)?; + } + } + + for m in spec.Mounts.iter() { + if m.destination == "/dev" { + let (flags, _) = parse_mount(m); + if flags.contains(MsFlags::MS_RDONLY) { + mount::mount( + Some("/dev"), + "/dev", + None::<&str>, + flags | MsFlags::MS_REMOUNT, + None::<&str>, + )?; + } + } + } + + if spec.Root.as_ref().unwrap().Readonly { + let flags = MsFlags::MS_BIND | MsFlags::MS_RDONLY | MsFlags::MS_NODEV | MsFlags::MS_REMOUNT; + + mount::mount(Some("/"), "/", None::<&str>, flags, None::<&str>)?; + } + stat::umask(Mode::from_bits_truncate(0o022)); + unistd::chdir(&olddir)?; + + Ok(()) +} + +fn mask_path(path: &str) -> Result<()> { + if !path.starts_with("/") || path.contains("..") { + return Err(nix::Error::Sys(Errno::EINVAL).into()); + } + + //info!("{}", path); + + match mount::mount( + Some("/dev/null"), + path, + None::<&str>, + MsFlags::MS_BIND, + None::<&str>, + ) { + Err(nix::Error::Sys(e)) => { + if e != Errno::ENOENT && e != Errno::ENOTDIR { + //info!("{}: {}", path, e.desc()); + return Err(nix::Error::Sys(e).into()); + } + } + + Err(e) => { + //info!("{}: {}", path, e.as_errno().unwrap().desc()); + return Err(e.into()); + } + + Ok(_) => {} + } + + Ok(()) +} + +fn readonly_path(path: &str) -> Result<()> { + if !path.starts_with("/") || path.contains("..") { + return Err(nix::Error::Sys(Errno::EINVAL).into()); + } + + //info!("{}", path); + + match mount::mount( + Some(&path[1..]), + path, + None::<&str>, + MsFlags::MS_BIND | MsFlags::MS_REC, + None::<&str>, + ) { + Err(nix::Error::Sys(e)) => { + if e == Errno::ENOENT { + return Ok(()); + } else { + //info!("{}: {}", path, e.desc()); + return Err(nix::Error::Sys(e).into()); + } + } + + Err(e) => { + //info!("{}: {}", path, e.as_errno().unwrap().desc()); + return Err(e.into()); + } + + Ok(_) => {} + } + + mount::mount( + Some(&path[1..]), + &path[1..], + None::<&str>, + MsFlags::MS_BIND | MsFlags::MS_REC | MsFlags::MS_RDONLY | MsFlags::MS_REMOUNT, + None::<&str>, + )?; + + Ok(()) +} diff --git a/src/agent/rustjail/src/process.rs b/src/agent/rustjail/src/process.rs new file mode 100644 index 0000000000..3d278b7ac3 --- /dev/null +++ b/src/agent/rustjail/src/process.rs @@ -0,0 +1,141 @@ +// Copyright (c) 2019 Ant Financial +// +// SPDX-License-Identifier: Apache-2.0 +// + +// use std::process::{Stdio, Command, ExitStatus}; +use libc::pid_t; +use std::fs::File; +use std::os::unix::io::RawFd; + +// use crate::configs::{Capabilities, Rlimit}; +// use crate::cgroups::Manager as CgroupManager; +// use crate::intelrdt::Manager as RdtManager; + +use nix::fcntl::OFlag; +use nix::sys::signal::{self, Signal}; +use nix::sys::socket::{self, AddressFamily, SockFlag, SockType}; +use nix::sys::wait::{self, WaitStatus}; +use nix::unistd::{self, Pid}; +use nix::Result; + +use nix::Error; +use protocols::oci::Process as OCIProcess; +use slog::Logger; + +#[derive(Debug)] +pub struct Process { + pub exec_id: String, + pub stdin: Option, + pub stdout: Option, + pub stderr: Option, + pub exit_pipe_r: Option, + pub exit_pipe_w: Option, + pub extra_files: Vec, + // pub caps: Capabilities, + // pub rlimits: Vec, + pub console_socket: Option, + pub term_master: Option, + // parent end of fds + pub parent_console_socket: Option, + pub parent_stdin: Option, + pub parent_stdout: Option, + pub parent_stderr: Option, + pub init: bool, + // pid of the init/exec process. since we have no command + // struct to store pid, we must store pid here. + pub pid: pid_t, + + pub exit_code: i32, + pub oci: OCIProcess, + pub logger: Logger, +} + +pub trait ProcessOperations { + fn pid(&self) -> Pid; + fn wait(&self) -> Result; + fn signal(&self, sig: Signal) -> Result<()>; +} + +impl ProcessOperations for Process { + fn pid(&self) -> Pid { + Pid::from_raw(self.pid) + } + + fn wait(&self) -> Result { + wait::waitpid(Some(self.pid()), None) + } + + fn signal(&self, sig: Signal) -> Result<()> { + signal::kill(self.pid(), Some(sig)) + } +} + +impl Process { + pub fn new(logger: &Logger, ocip: &OCIProcess, id: &str, init: bool) -> Result { + let logger = logger.new(o!("subsystem" => "process")); + + let mut p = Process { + exec_id: String::from(id), + stdin: None, + stdout: None, + stderr: None, + exit_pipe_w: None, + exit_pipe_r: None, + extra_files: Vec::new(), + console_socket: None, + term_master: None, + parent_console_socket: None, + parent_stdin: None, + parent_stdout: None, + parent_stderr: None, + init, + pid: -1, + exit_code: 0, + oci: ocip.clone(), + logger: logger.clone(), + }; + + info!(logger, "before create console socket!"); + + if ocip.Terminal { + let (psocket, csocket) = match socket::socketpair( + AddressFamily::Unix, + SockType::Stream, + None, + SockFlag::SOCK_CLOEXEC, + ) { + Ok((u, v)) => (u, v), + Err(e) => { + match e { + Error::Sys(errno) => { + info!(logger, "socketpair: {}", errno.desc()); + } + _ => { + info!(logger, "socketpair: other error!"); + } + } + return Err(e); + } + }; + p.parent_console_socket = Some(psocket); + p.console_socket = Some(csocket); + } + + info!(logger, "created console socket!"); + + let (stdin, pstdin) = unistd::pipe2(OFlag::O_CLOEXEC)?; + p.parent_stdin = Some(pstdin); + p.stdin = Some(stdin); + + let (pstdout, stdout) = unistd::pipe2(OFlag::O_CLOEXEC)?; + p.parent_stdout = Some(pstdout); + p.stdout = Some(stdout); + + let (pstderr, stderr) = unistd::pipe2(OFlag::O_CLOEXEC)?; + p.parent_stderr = Some(pstderr); + p.stderr = Some(stderr); + + Ok(p) + } +} diff --git a/src/agent/rustjail/src/specconv.rs b/src/agent/rustjail/src/specconv.rs new file mode 100644 index 0000000000..0803bfba95 --- /dev/null +++ b/src/agent/rustjail/src/specconv.rs @@ -0,0 +1,159 @@ +// Copyright (c) 2019 Ant Financial +// +// SPDX-License-Identifier: Apache-2.0 +// + +use protocols::oci::Spec; +// use crate::configs::namespaces; +// use crate::configs::device::Device; + +#[derive(Debug)] +pub struct CreateOpts { + pub cgroup_name: String, + pub use_systemd_cgroup: bool, + pub no_pivot_root: bool, + pub no_new_keyring: bool, + pub spec: Option, + pub rootless_euid: bool, + pub rootless_cgroup: bool, +} +/* +const WILDCARD: i32 = -1; + +lazy_static! { + static ref NAEMSPACEMAPPING: HashMap<&'static str, &'static str> = { + let mut m = HashMap::new(); + m.insert(oci::PIDNAMESPACE, namespaces::NEWPID); + m.insert(oci::NETWORKNAMESPACE, namespaces::NEWNET); + m.insert(oci::UTSNAMESPACE, namespaces::NEWUTS); + m.insert(oci::MOUNTNAMESPACE, namespaces::NEWNS); + m.insert(oci::IPCNAMESPACE, namespaces::NEWIPC); + m.insert(oci::USERNAMESPACE, namespaces::NEWUSER); + m.insert(oci::CGROUPNAMESPACE, namespaces::NEWCGROUP); + m + }; + + static ref MOUNTPROPAGATIONMAPPING: HashMap<&'static str, MsFlags> = { + let mut m = HashMap::new(); + m.insert("rprivate", MsFlags::MS_PRIVATE | MsFlags::MS_REC); + m.insert("private", MsFlags::MS_PRIVATE); + m.insert("rslave", MsFlags::MS_SLAVE | MsFlags::MS_REC); + m.insert("slave", MsFlags::MS_SLAVE); + m.insert("rshared", MsFlags::MS_SHARED | MsFlags::MS_REC); + m.insert("shared", MsFlags::MS_SHARED); + m.insert("runbindable", MsFlags::MS_UNBINDABLE | MsFlags::MS_REC); + m.insert("unbindable", MsFlags::MS_UNBINDABLE); + m + }; + + static ref ALLOWED_DEVICES: Vec = { + let mut m = Vec::new(); + m.push(Device { + r#type: 'c', + major: WILDCARD, + minor: WILDCARD, + permissions: "m", + allow: true, + }); + + m.push(Device { + r#type: 'b', + major: WILDCARD, + minor: WILDCARD, + permissions: "m", + allow: true, + }); + + m.push(Device { + r#type: 'c', + path: "/dev/null".to_string(), + major: 1, + minor: 3, + permissions: "rwm", + allow: true, + }); + + m.push(Device { + r#type: 'c', + path: String::from("/dev/random"), + major: 1, + minor: 8, + permissions: "rwm", + allow: true, + }); + + m.push(Device { + r#type: 'c', + path: String::from("/dev/full"), + major: 1, + minor: 7, + permissions: "rwm", + allow: true, + }); + + m.push(Device { + r#type: 'c', + path: String::from("/dev/tty"), + major: 5, + minor: 0, + permissions: "rwm", + allow: true, + }); + + m.push(Device { + r#type: 'c', + path: String::from("/dev/zero"), + major: 1, + minor: 5, + permissions: "rwm", + allow: true, + }); + + m.push(Device { + r#type: 'c', + path: String::from("/dev/urandom"), + major: 1, + minor: 9, + permissions: "rwm", + allow: true, + }); + + m.push(Device { + r#type: 'c', + path: String::from("/dev/console"), + major: 5, + minor: 1, + permissions: "rwm", + allow: true, + }); + + m.push(Device { + r#type: 'c', + path: String::from(""), + major: 136, + minor: WILDCARD, + permissions: "rwm", + allow: true, + }); + + m.push(Device { + r#type: 'c', + path: String::from(""), + major: 5, + minor: 2, + permissions: "rwm", + allow: true, + }); + + m.push(Device { + r#type: 'c', + path: String::from(""), + major: 10, + minor: 200, + permissions: "rwm", + allow: true, + }); + m + }; +} +*/ diff --git a/src/agent/rustjail/src/validator.rs b/src/agent/rustjail/src/validator.rs new file mode 100644 index 0000000000..372c07cc14 --- /dev/null +++ b/src/agent/rustjail/src/validator.rs @@ -0,0 +1,304 @@ +use crate::container::Config; +use crate::errors::*; +use lazy_static; +use nix::errno::Errno; +use nix::Error; +use protobuf::RepeatedField; +use protocols::oci::{LinuxIDMapping, LinuxNamespace, Spec}; +use std::collections::HashMap; +use std::path::{Component, PathBuf}; + +fn contain_namespace(nses: &RepeatedField, key: &str) -> bool { + for ns in nses { + if ns.Type.as_str() == key { + return true; + } + } + + false +} + +fn get_namespace_path(nses: &RepeatedField, key: &str) -> Result { + for ns in nses { + if ns.Type.as_str() == key { + return Ok(ns.Path.clone()); + } + } + + Err(ErrorKind::Nix(Error::from_errno(Errno::EINVAL)).into()) +} + +fn rootfs(root: &str) -> Result<()> { + let path = PathBuf::from(root); + // not absolute path or not exists + if !path.exists() || !path.is_absolute() { + return Err(ErrorKind::Nix(Error::from_errno(Errno::EINVAL)).into()); + } + + // symbolic link? ..? + let mut stack: Vec = Vec::new(); + for c in path.components() { + if stack.is_empty() { + if c == Component::RootDir || c == Component::ParentDir { + continue; + } + } + + if c == Component::ParentDir { + stack.pop(); + continue; + } + + stack.push(c.as_os_str().to_str().unwrap().to_string()); + } + + let mut cleaned = PathBuf::from("/"); + for e in stack.iter() { + cleaned.push(e); + } + + let canon = path.canonicalize()?; + if cleaned != canon { + // There is symbolic in path + return Err(ErrorKind::Nix(Error::from_errno(Errno::EINVAL)).into()); + } + + Ok(()) +} + +fn network(_oci: &Spec) -> Result<()> { + Ok(()) +} + +fn hostname(oci: &Spec) -> Result<()> { + if oci.Hostname.is_empty() || oci.Hostname == "".to_string() { + return Ok(()); + } + + if oci.Linux.is_none() { + return Err(ErrorKind::Nix(Error::from_errno(Errno::EINVAL)).into()); + } + let linux = oci.Linux.as_ref().unwrap(); + if !contain_namespace(&linux.Namespaces, "uts") { + return Err(ErrorKind::Nix(Error::from_errno(Errno::EINVAL)).into()); + } + + Ok(()) +} + +fn security(oci: &Spec) -> Result<()> { + let linux = oci.Linux.as_ref().unwrap(); + if linux.MaskedPaths.len() == 0 && linux.ReadonlyPaths.len() == 0 { + return Ok(()); + } + + if !contain_namespace(&linux.Namespaces, "mount") { + return Err(ErrorKind::Nix(Error::from_errno(Errno::EINVAL)).into()); + } + + // don't care about selinux at present + + Ok(()) +} + +fn idmapping(maps: &RepeatedField) -> Result<()> { + for map in maps { + if map.Size > 0 { + return Ok(()); + } + } + + Err(ErrorKind::Nix(Error::from_errno(Errno::EINVAL)).into()) +} + +fn usernamespace(oci: &Spec) -> Result<()> { + let linux = oci.Linux.as_ref().unwrap(); + if contain_namespace(&linux.Namespaces, "user") { + let user_ns = PathBuf::from("/proc/self/ns/user"); + if !user_ns.exists() { + return Err(ErrorKind::ErrorCode("user namespace not supported!".to_string()).into()); + } + // check if idmappings is correct, at least I saw idmaps + // with zero size was passed to agent + idmapping(&linux.UIDMappings)?; + idmapping(&linux.GIDMappings)?; + } else { + // no user namespace but idmap + if linux.UIDMappings.len() != 0 || linux.GIDMappings.len() != 0 { + return Err(ErrorKind::Nix(Error::from_errno(Errno::EINVAL)).into()); + } + } + + Ok(()) +} + +fn cgroupnamespace(oci: &Spec) -> Result<()> { + let linux = oci.Linux.as_ref().unwrap(); + if contain_namespace(&linux.Namespaces, "cgroup") { + let path = PathBuf::from("/proc/self/ns/cgroup"); + if !path.exists() { + return Err(ErrorKind::ErrorCode("cgroup unsupported!".to_string()).into()); + } + } + Ok(()) +} + +lazy_static! { + pub static ref SYSCTLS: HashMap<&'static str, bool> = { + let mut m = HashMap::new(); + m.insert("kernel.msgmax", true); + m.insert("kernel.msgmnb", true); + m.insert("kernel.msgmni", true); + m.insert("kernel.sem", true); + m.insert("kernel.shmall", true); + m.insert("kernel.shmmax", true); + m.insert("kernel.shmmni", true); + m.insert("kernel.shm_rmid_forced", true); + m + }; +} + +fn check_host_ns(path: &str) -> Result<()> { + let cpath = PathBuf::from(path); + let hpath = PathBuf::from("/proc/self/ns/net"); + + let real_hpath = hpath.read_link()?; + let meta = cpath.symlink_metadata()?; + let file_type = meta.file_type(); + + if !file_type.is_symlink() { + return Ok(()); + } + let real_cpath = cpath.read_link()?; + if real_cpath == real_hpath { + return Err(ErrorKind::Nix(Error::from_errno(Errno::EINVAL)).into()); + } + + Ok(()) +} + +fn sysctl(oci: &Spec) -> Result<()> { + let linux = oci.Linux.as_ref().unwrap(); + for (key, _) in linux.Sysctl.iter() { + if SYSCTLS.contains_key(key.as_str()) || key.starts_with("fs.mqueue.") { + if contain_namespace(&linux.Namespaces, "ipc") { + continue; + } else { + return Err(ErrorKind::Nix(Error::from_errno(Errno::EINVAL)).into()); + } + } + + if key.starts_with("net.") { + if !contain_namespace(&linux.Namespaces, "network") { + return Err(ErrorKind::Nix(Error::from_errno(Errno::EINVAL)).into()); + } + + let net = get_namespace_path(&linux.Namespaces, "network")?; + if net.is_empty() || net == "".to_string() { + continue; + } + + check_host_ns(net.as_str())?; + } + + if contain_namespace(&linux.Namespaces, "uts") { + if key == "kernel.domainname" { + continue; + } + + if key == "kernel.hostname" { + return Err(ErrorKind::Nix(Error::from_errno(Errno::EINVAL)).into()); + } + } + + return Err(ErrorKind::Nix(Error::from_errno(Errno::EINVAL)).into()); + } + Ok(()) +} + +fn rootless_euid_mapping(oci: &Spec) -> Result<()> { + let linux = oci.Linux.as_ref().unwrap(); + if !contain_namespace(&linux.Namespaces, "user") { + return Err(ErrorKind::Nix(Error::from_errno(Errno::EINVAL)).into()); + } + + if linux.UIDMappings.len() == 0 || linux.GIDMappings.len() == 0 { + return Err(ErrorKind::Nix(Error::from_errno(Errno::EINVAL)).into()); + } + + Ok(()) +} + +fn has_idmapping(maps: &RepeatedField, id: u32) -> bool { + for map in maps { + if id >= map.ContainerID && id < map.ContainerID + map.Size { + return true; + } + } + false +} + +fn rootless_euid_mount(oci: &Spec) -> Result<()> { + let linux = oci.Linux.as_ref().unwrap(); + + for mnt in oci.Mounts.iter() { + for opt in mnt.options.iter() { + if opt.starts_with("uid=") || opt.starts_with("gid=") { + let fields: Vec<&str> = opt.split('=').collect(); + + if fields.len() != 2 { + return Err(ErrorKind::Nix(Error::from_errno(Errno::EINVAL)).into()); + } + + let id = fields[1].trim().parse::()?; + + if opt.starts_with("uid=") { + if !has_idmapping(&linux.UIDMappings, id) { + return Err(ErrorKind::Nix(Error::from_errno(Errno::EINVAL)).into()); + } + } + + if opt.starts_with("gid=") { + if !has_idmapping(&linux.GIDMappings, id) { + return Err(ErrorKind::Nix(Error::from_errno(Errno::EINVAL)).into()); + } + } + } + } + } + Ok(()) +} + +fn rootless_euid(oci: &Spec) -> Result<()> { + rootless_euid_mapping(oci)?; + rootless_euid_mount(oci)?; + Ok(()) +} + +pub fn validate(conf: &Config) -> Result<()> { + lazy_static::initialize(&SYSCTLS); + let oci = conf.spec.as_ref().unwrap(); + + if oci.Linux.is_none() { + return Err(ErrorKind::Nix(Error::from_errno(Errno::EINVAL)).into()); + } + + if oci.Root.is_none() { + return Err(ErrorKind::Nix(Error::from_errno(Errno::EINVAL)).into()); + } + let root = oci.Root.get_ref().Path.as_str(); + + rootfs(root)?; + network(oci)?; + hostname(oci)?; + security(oci)?; + usernamespace(oci)?; + cgroupnamespace(oci)?; + sysctl(&oci)?; + + if conf.rootless_euid { + rootless_euid(oci)?; + } + + Ok(()) +} diff --git a/src/agent/src/device.rs b/src/agent/src/device.rs new file mode 100644 index 0000000000..2749ad7ce6 --- /dev/null +++ b/src/agent/src/device.rs @@ -0,0 +1,423 @@ +// Copyright (c) 2019 Ant Financial +// +// SPDX-License-Identifier: Apache-2.0 +// + +use rustjail::errors::*; +use std::fs; +// use std::io::Write; +use libc::{c_uint, major, minor}; +use std::collections::HashMap; +use std::os::unix::fs::MetadataExt; +use std::path::Path; +use std::sync::mpsc; +use std::sync::{Arc, Mutex}; +use std::time::Duration; + +use crate::mount::{ + DRIVERBLKTYPE, DRIVERMMIOBLKTYPE, DRIVERNVDIMMTYPE, DRIVERSCSITYPE, TIMEOUT_HOTPLUG, +}; +use crate::sandbox::Sandbox; +use crate::GLOBAL_DEVICE_WATCHER; +use protocols::agent::Device; +use protocols::oci::Spec; + +// Convenience macro to obtain the scope logger +macro_rules! sl { + () => { + slog_scope::logger().new(o!("subsystem" => "device")) + }; +} + +#[cfg(any( + target_arch = "x86_64", + target_arch = "x86", + target_arch = "powerpc64le", + target_arch = "s390x" +))] +pub const ROOT_BUS_PATH: &'static str = "/devices/pci0000:00"; +#[cfg(target_arch = "arm")] +pub const ROOT_BUS_PATH: &'static str = "/devices/platform/4010000000.pcie/pci0000:00"; + +pub const SYSFS_DIR: &'static str = "/sys"; + +const SYS_BUS_PREFIX: &'static str = "/sys/bus/pci/devices"; +const PCI_BUS_RESCAN_FILE: &'static str = "/sys/bus/pci/rescan"; +const SYSTEM_DEV_PATH: &'static str = "/dev"; + +// SCSI const + +// Here in "0:0", the first number is the SCSI host number because +// only one SCSI controller has been plugged, while the second number +// is always 0. +pub const SCSI_HOST_CHANNEL: &'static str = "0:0:"; +const SYS_CLASS_PREFIX: &'static str = "/sys/class"; +const SCSI_DISK_PREFIX: &'static str = "/sys/class/scsi_disk/0:0:"; +pub const SCSI_BLOCK_SUFFIX: &'static str = "block"; +const SCSI_DISK_SUFFIX: &'static str = "/device/block"; +const SCSI_HOST_PATH: &'static str = "/sys/class/scsi_host"; + +// DeviceHandler is the type of callback to be defined to handle every +// type of device driver. +type DeviceHandler = fn(&Device, &mut Spec, Arc>) -> Result<()>; + +// DeviceHandlerList lists the supported drivers. +#[cfg_attr(rustfmt, rustfmt_skip)] +lazy_static! { + pub static ref DEVICEHANDLERLIST: HashMap<&'static str, DeviceHandler> = { + let mut m = HashMap::new(); + let blk: DeviceHandler = virtio_blk_device_handler; + m.insert(DRIVERBLKTYPE, blk); + let virtiommio: DeviceHandler = virtiommio_blk_device_handler; + m.insert(DRIVERMMIOBLKTYPE, virtiommio); + let local: DeviceHandler = virtio_nvdimm_device_handler; + m.insert(DRIVERNVDIMMTYPE, local); + let scsi: DeviceHandler = virtio_scsi_device_handler; + m.insert(DRIVERSCSITYPE, scsi); + m + }; +} + +pub fn rescan_pci_bus() -> Result<()> { + online_device(PCI_BUS_RESCAN_FILE) +} + +pub fn online_device(path: &str) -> Result<()> { + fs::write(path, "1")?; + Ok(()) +} + +// get_device_pci_address fetches the complete PCI address in sysfs, based on the PCI +// identifier provided. This should be in the format: "bridgeAddr/deviceAddr". +// Here, bridgeAddr is the address at which the brige is attached on the root bus, +// while deviceAddr is the address at which the device is attached on the bridge. +pub fn get_device_pci_address(pci_id: &str) -> Result { + let tokens: Vec<&str> = pci_id.split("/").collect(); + + if tokens.len() != 2 { + return Err(ErrorKind::ErrorCode(format!( + "PCI Identifier for device should be of format [bridgeAddr/deviceAddr], got {}", + pci_id + )) + .into()); + } + + let bridge_id = tokens[0]; + let device_id = tokens[1]; + + // Deduce the complete bridge address based on the bridge address identifier passed + // and the fact that bridges are attached on the main bus with function 0. + let pci_bridge_addr = format!("0000:00:{}.0", bridge_id); + + // Find out the bus exposed by bridge + let bridge_bus_path = format!("{}/{}/pci_bus/", SYS_BUS_PREFIX, pci_bridge_addr); + + let files_slice: Vec<_> = fs::read_dir(&bridge_bus_path) + .unwrap() + .map(|res| res.unwrap().path()) + .collect(); + let bus_num = files_slice.len(); + + if bus_num != 1 { + return Err(ErrorKind::ErrorCode(format!( + "Expected an entry for bus in {}, got {} entries instead", + bridge_bus_path, bus_num + )) + .into()); + } + + let bus = files_slice[0].file_name().unwrap().to_str().unwrap(); + + // Device address is based on the bus of the bridge to which it is attached. + // We do not pass devices as multifunction, hence the trailing 0 in the address. + let pci_device_addr = format!("{}:{}.0", bus, device_id); + + let bridge_device_pci_addr = format!("{}/{}", pci_bridge_addr, pci_device_addr); + + info!( + sl!(), + "Fetched PCI address for device PCIAddr:{}\n", bridge_device_pci_addr + ); + + Ok(bridge_device_pci_addr) +} + +pub fn get_device_name(sandbox: Arc>, dev_addr: &str) -> Result { + let mut dev_name: String = String::default(); + let (tx, rx) = mpsc::channel::(); + + { + let watcher = GLOBAL_DEVICE_WATCHER.clone(); + let mut w = watcher.lock().unwrap(); + + let s = sandbox.clone(); + let sb = s.lock().unwrap(); + + for (key, value) in &(sb.pci_device_map) { + if key.contains(dev_addr) { + dev_name = value.to_string(); + info!(sl!(), "Device {} found in pci device map", dev_addr); + break; + } + } + + // If device is not found in the device map, hotplug event has not + // been received yet, create and add channel to the watchers map. + // The key of the watchers map is the device we are interested in. + // Note this is done inside the lock, not to miss any events from the + // global udev listener. + if dev_name == "" { + w.insert(dev_addr.to_string(), tx); + } + } + + if dev_name == "" { + info!(sl!(), "Waiting on channel for device notification\n"); + + match rx.recv_timeout(Duration::from_secs(TIMEOUT_HOTPLUG)) { + Ok(name) => dev_name = name, + Err(_) => { + let watcher = GLOBAL_DEVICE_WATCHER.clone(); + let mut w = watcher.lock().unwrap(); + w.remove_entry(dev_addr); + + return Err(ErrorKind::ErrorCode(format!( + "Timeout reached after {} waiting for device {}", + TIMEOUT_HOTPLUG, dev_addr + )) + .into()); + } + } + } + + Ok(format!("{}/{}", SYSTEM_DEV_PATH, &dev_name)) +} + +pub fn get_scsi_device_name(sandbox: Arc>, scsi_addr: &str) -> Result { + scan_scsi_bus(scsi_addr)?; + + let dev_sub_path = format!("{}{}/{}", SCSI_HOST_CHANNEL, scsi_addr, SCSI_BLOCK_SUFFIX); + + get_device_name(sandbox, dev_sub_path.as_str()) +} + +pub fn get_pci_device_name(sandbox: Arc>, pci_id: &str) -> Result { + let pci_addr = get_device_pci_address(pci_id)?; + + rescan_pci_bus()?; + + get_device_name(sandbox, pci_addr.as_str()) +} + +// scan_scsi_bus scans SCSI bus for the given SCSI address(SCSI-Id and LUN) +pub fn scan_scsi_bus(scsi_addr: &str) -> Result<()> { + let tokens: Vec<&str> = scsi_addr.split(":").collect(); + if tokens.len() != 2 { + return Err(ErrorKind::Msg(format!( + "Unexpected format for SCSI Address: {}, expect SCSIID:LUA", + scsi_addr + )) + .into()); + } + + // Scan scsi host passing in the channel, SCSI id and LUN. Channel + // is always 0 because we have only one SCSI controller. + let scan_data = format!("0 {} {}", tokens[0], tokens[1]); + + for entry in fs::read_dir(SCSI_HOST_PATH)? { + let entry = entry?; + + let host = entry.file_name(); + let scan_path = format!("{}/{}/{}", SCSI_HOST_PATH, host.to_str().unwrap(), "scan"); + + fs::write(scan_path, &scan_data)?; + } + + Ok(()) +} + +// update_spec_device_list takes a device description provided by the caller, +// trying to find it on the guest. Once this device has been identified, the +// "real" information that can be read from inside the VM is used to update +// the same device in the list of devices provided through the OCI spec. +// This is needed to update information about minor/major numbers that cannot +// be predicted from the caller. +fn update_spec_device_list(device: &Device, spec: &mut Spec) -> Result<()> { + // If no container_path is provided, we won't be able to match and + // update the device in the OCI spec device list. This is an error. + + let major_id: c_uint; + let minor_id: c_uint; + + // If no container_path is provided, we won't be able to match and + // update the device in the OCI spec device list. This is an error. + if device.container_path == "" { + return Err(ErrorKind::Msg(format!( + "container_path cannot empty for device {:?}", + device + )) + .into()); + } + + let linux = match spec.Linux.as_mut() { + None => { + return Err( + ErrorKind::ErrorCode("Spec didn't container linux field".to_string()).into(), + ) + } + Some(l) => l, + }; + + if !Path::new(&device.vm_path).exists() { + return Err(ErrorKind::Msg(format!("vm_path:{} doesn't exist", device.vm_path)).into()); + } + + let meta = fs::metadata(&device.vm_path)?; + let dev_id = meta.rdev(); + unsafe { + major_id = major(dev_id); + minor_id = minor(dev_id); + } + + info!( + sl!(), + "got the device: dev_path: {}, major: {}, minor: {}\n", &device.vm_path, major_id, minor_id + ); + + let devices = linux.Devices.as_mut_slice(); + for dev in devices.iter_mut() { + if dev.Path == device.container_path { + let host_major = dev.Major; + let host_minor = dev.Minor; + + dev.Major = major_id as i64; + dev.Minor = minor_id as i64; + + info!( + sl!(), + "change the device from major: {} minor: {} to vm device major: {} minor: {}", + host_major, + host_minor, + major_id, + minor_id + ); + + // Resources must be updated since they are used to identify the + // device in the devices cgroup. + let resource = linux.Resources.as_mut(); + if resource.is_some() { + let res = resource.unwrap(); + let ds = res.Devices.as_mut_slice(); + for d in ds.iter_mut() { + if d.Major == host_major && d.Minor == host_minor { + d.Major = major_id as i64; + d.Minor = minor_id as i64; + + info!( + sl!(), + "set resources for device major: {} minor: {}\n", major_id, minor_id + ); + } + } + } + } + } + + Ok(()) +} + +// device.Id should be the predicted device name (vda, vdb, ...) +// device.VmPath already provides a way to send it in +fn virtiommio_blk_device_handler( + device: &Device, + spec: &mut Spec, + _sandbox: Arc>, +) -> Result<()> { + if device.vm_path == "" { + return Err(ErrorKind::Msg("Invalid path for virtiommioblkdevice".to_string()).into()); + } + + update_spec_device_list(device, spec) +} + +// device.Id should be the PCI address in the format "bridgeAddr/deviceAddr". +// Here, bridgeAddr is the address at which the brige is attached on the root bus, +// while deviceAddr is the address at which the device is attached on the bridge. +fn virtio_blk_device_handler( + device: &Device, + spec: &mut Spec, + sandbox: Arc>, +) -> Result<()> { + let dev_path = get_pci_device_name(sandbox, device.id.as_str())?; + + let mut dev = device.clone(); + dev.vm_path = dev_path; + + update_spec_device_list(&dev, spec) +} + +// device.Id should be the SCSI address of the disk in the format "scsiID:lunID" +fn virtio_scsi_device_handler( + device: &Device, + spec: &mut Spec, + sandbox: Arc>, +) -> Result<()> { + let dev_path = get_scsi_device_name(sandbox, device.id.as_str())?; + + let mut dev = device.clone(); + dev.vm_path = dev_path; + + update_spec_device_list(&dev, spec) +} + +fn virtio_nvdimm_device_handler( + device: &Device, + spec: &mut Spec, + _sandbox: Arc>, +) -> Result<()> { + update_spec_device_list(device, spec) +} + +pub fn add_devices( + devices: Vec, + spec: &mut Spec, + sandbox: Arc>, +) -> Result<()> { + for device in devices.iter() { + add_device(device, spec, sandbox.clone())?; + } + + Ok(()) +} + +fn add_device(device: &Device, spec: &mut Spec, sandbox: Arc>) -> Result<()> { + // log before validation to help with debugging gRPC protocol + // version differences. + info!(sl!(), "device-id: {}, device-type: {}, device-vm-path: {}, device-container-path: {}, device-options: {:?}", + device.id, device.field_type, device.vm_path, device.container_path, device.options); + + if device.field_type == "" { + return Err(ErrorKind::Msg(format!("invalid type for device {:?}", device)).into()); + } + + if device.id == "" && device.vm_path == "" { + return Err( + ErrorKind::Msg(format!("invalid ID and VM path for device {:?}", device)).into(), + ); + } + + if device.container_path == "" { + return Err( + ErrorKind::Msg(format!("invalid container path for device {:?}", device)).into(), + ); + } + + let dev_handler = match DEVICEHANDLERLIST.get(device.field_type.as_str()) { + None => { + return Err(ErrorKind::Msg(format!("Unknown device type {}", device.field_type)).into()) + } + Some(t) => t, + }; + + dev_handler(device, spec, sandbox) +} diff --git a/src/agent/src/grpc.rs b/src/agent/src/grpc.rs new file mode 100644 index 0000000000..562d70ef4b --- /dev/null +++ b/src/agent/src/grpc.rs @@ -0,0 +1,1774 @@ +// Copyright (c) 2019 Ant Financial +// +// SPDX-License-Identifier: Apache-2.0 +// + +use futures::*; +use grpcio::{EnvBuilder, Server, ServerBuilder}; +use grpcio::{RpcStatus, RpcStatusCode}; +use std::sync::{Arc, Mutex}; + +use protobuf::{RepeatedField, SingularPtrField}; +use protocols::agent::CopyFileRequest; +use protocols::agent::{ + AgentDetails, GuestDetailsResponse, ListProcessesResponse, ReadStreamResponse, + WaitProcessResponse, WriteStreamResponse, +}; +use protocols::empty::Empty; +use protocols::health::{HealthCheckResponse, HealthCheckResponse_ServingStatus}; +use protocols::oci::{LinuxNamespace, Spec}; +use rustjail; +use rustjail::container::{BaseContainer, LinuxContainer}; +use rustjail::errors::*; +use rustjail::process::Process; +use rustjail::specconv::CreateOpts; + +use nix::errno::Errno; +use nix::sys::signal::Signal; +use nix::sys::stat; +use nix::unistd::{self, Pid}; +use rustjail::process::ProcessOperations; + +use crate::device::{add_devices, rescan_pci_bus}; +use crate::mount::{add_storages, remove_mounts, STORAGEHANDLERLIST}; +use crate::namespace::{NSTYPEIPC, NSTYPEPID, NSTYPEUTS}; +use crate::netlink::{RtnlHandle, NETLINK_ROUTE}; +use crate::random; +use crate::sandbox::Sandbox; +use crate::version::{AGENT_VERSION, API_VERSION}; + +use libc::{self, c_ushort, pid_t, winsize, TIOCSWINSZ}; +use serde_json; +use std::fs; +use std::os::unix::io::RawFd; +use std::process::{Command, Stdio}; +use std::sync::mpsc; +use std::thread; +use std::time::Duration; + +use nix::unistd::{Gid, Uid}; +use std::fs::{File, OpenOptions}; +use std::io::{BufRead, BufReader}; +use std::os::unix::fs::FileExt; +use std::path::PathBuf; + +const SYSFS_MEMORY_BLOCK_SIZE_PATH: &'static str = "/sys/devices/system/memory/block_size_bytes"; +const SYSFS_MEMORY_HOTPLUG_PROBE_PATH: &'static str = "/sys/devices/system/memory/probe"; +pub const SYSFS_MEMORY_ONLINE_PATH: &'static str = "/sys/devices/system/memory"; +const CONTAINER_BASE: &'static str = "/run/agent"; + +// Convenience macro to obtain the scope logger +macro_rules! sl { + () => { + slog_scope::logger() + }; +} + +#[derive(Clone)] +struct agentService { + sandbox: Arc>, + test: u32, +} + +impl agentService { + fn do_create_container(&mut self, req: protocols::agent::CreateContainerRequest) -> Result<()> { + let cid = req.container_id.clone(); + let eid = req.exec_id.clone(); + + let mut oci_spec = req.OCI.clone(); + + let sandbox; + let mut s; + + let oci = oci_spec.as_mut().unwrap(); + + info!(sl!(), "receive createcontainer {}", &cid); + + // re-scan PCI bus + // looking for hidden devices + + rescan_pci_bus().chain_err(|| "Could not rescan PCI bus")?; + + // Some devices need some extra processing (the ones invoked with + // --device for instance), and that's what this call is doing. It + // updates the devices listed in the OCI spec, so that they actually + // match real devices inside the VM. This step is necessary since we + // cannot predict everything from the caller. + add_devices(req.devices.to_vec(), oci, self.sandbox.clone())?; + + // Both rootfs and volumes (invoked with --volume for instance) will + // be processed the same way. The idea is to always mount any provided + // storage to the specified MountPoint, so that it will match what's + // inside oci.Mounts. + // After all those storages have been processed, no matter the order + // here, the agent will rely on rustjail (using the oci.Mounts + // list) to bind mount all of them inside the container. + let m = add_storages(sl!(), req.storages.to_vec(), self.sandbox.clone())?; + { + sandbox = self.sandbox.clone(); + s = sandbox.lock().unwrap(); + s.container_mounts.insert(cid.clone(), m); + } + + update_container_namespaces(&s, oci)?; + + // write spec to bundle path, hooks might + // read ocispec + setup_bundle(oci)?; + + let opts = CreateOpts { + cgroup_name: "".to_string(), + use_systemd_cgroup: false, + no_pivot_root: s.no_pivot_root, + no_new_keyring: false, + spec: Some(oci.clone()), + rootless_euid: false, + rootless_cgroup: false, + }; + + let mut ctr: LinuxContainer = + LinuxContainer::new(cid.as_str(), CONTAINER_BASE, opts, &sl!())?; + + let p = if oci.Process.is_some() { + let tp = Process::new(&sl!(), oci.get_Process(), eid.as_str(), true)?; + tp + } else { + info!(sl!(), "no process configurations!"); + return Err(ErrorKind::Nix(nix::Error::from_errno(nix::errno::Errno::EINVAL)).into()); + }; + + ctr.start(p)?; + + s.add_container(ctr); + info!(sl!(), "created container!"); + + Ok(()) + } + + fn do_start_container(&mut self, req: protocols::agent::StartContainerRequest) -> Result<()> { + let cid = req.container_id.clone(); + + let sandbox = self.sandbox.clone(); + let mut s = sandbox.lock().unwrap(); + + let ctr: &mut LinuxContainer = match s.get_container(cid.as_str()) { + Some(cr) => cr, + None => { + return Err(ErrorKind::Nix(nix::Error::from_errno(Errno::EINVAL)).into()); + } + }; + + ctr.exec()?; + + Ok(()) + } + + fn do_remove_container(&mut self, req: protocols::agent::RemoveContainerRequest) -> Result<()> { + let cid = req.container_id.clone(); + let mut cmounts: Vec = vec![]; + + if req.timeout == 0 { + let s = Arc::clone(&self.sandbox); + let mut sandbox = s.lock().unwrap(); + let ctr = sandbox.get_container(cid.as_str()).unwrap(); + + ctr.destroy()?; + + // Find the sandbox storage used by this container + let mounts = sandbox.container_mounts.get(&cid); + if mounts.is_some() { + let mounts = mounts.unwrap(); + + remove_mounts(&mounts)?; + + for m in mounts.iter() { + if sandbox.storages.get(m).is_some() { + cmounts.push(m.to_string()); + } + } + } + + for m in cmounts.iter() { + sandbox.unset_and_remove_sandbox_storage(m)?; + } + + sandbox.container_mounts.remove(cid.as_str()); + sandbox.containers.remove(cid.as_str()); + + return Ok(()); + } + + // timeout != 0 + let s = Arc::clone(&self.sandbox); + let cid2 = cid.clone(); + let (tx, rx) = mpsc::channel(); + + let handle = thread::spawn(move || { + let mut sandbox = s.lock().unwrap(); + let ctr = sandbox.get_container(cid2.as_str()).unwrap(); + + ctr.destroy().unwrap(); + tx.send(1).unwrap(); + }); + + if let Err(_) = rx.recv_timeout(Duration::from_secs(req.timeout as u64)) { + return Err(ErrorKind::Nix(nix::Error::from_errno(nix::errno::Errno::ETIME)).into()); + } + + if let Err(_) = handle.join() { + return Err( + ErrorKind::Nix(nix::Error::from_errno(nix::errno::Errno::UnknownErrno)).into(), + ); + } + + let s = Arc::clone(&self.sandbox); + let mut sandbox = s.lock().unwrap(); + + // Find the sandbox storage used by this container + let mounts = sandbox.container_mounts.get(&cid); + if mounts.is_some() { + let mounts = mounts.unwrap(); + + remove_mounts(&mounts)?; + + for m in mounts.iter() { + if sandbox.storages.get(m).is_some() { + cmounts.push(m.to_string()); + } + } + } + + for m in cmounts.iter() { + sandbox.unset_and_remove_sandbox_storage(m)?; + } + + sandbox.container_mounts.remove(&cid); + sandbox.containers.remove(cid.as_str()); + + Ok(()) + } + + fn do_exec_process(&mut self, req: protocols::agent::ExecProcessRequest) -> Result<()> { + let cid = req.container_id.clone(); + let exec_id = req.exec_id.clone(); + + info!(sl!(), "cid: {} eid: {}", cid.clone(), exec_id.clone()); + + let s = Arc::clone(&self.sandbox); + let mut sandbox = s.lock().unwrap(); + + // ignore string_user, not sure what it is + let ocip = if req.process.is_some() { + req.process.as_ref().unwrap() + } else { + return Err(ErrorKind::Nix(nix::Error::from_errno(nix::errno::Errno::EINVAL)).into()); + }; + + let p = Process::new(&sl!(), ocip, exec_id.as_str(), false)?; + + let ctr = match sandbox.get_container(cid.as_str()) { + Some(v) => v, + None => { + return Err( + ErrorKind::Nix(nix::Error::from_errno(nix::errno::Errno::EINVAL)).into(), + ); + } + }; + + ctr.run(p)?; + + Ok(()) + } + + fn do_signal_process(&mut self, req: protocols::agent::SignalProcessRequest) -> Result<()> { + let cid = req.container_id.clone(); + let eid = req.exec_id.clone(); + let s = Arc::clone(&self.sandbox); + let mut sandbox = s.lock().unwrap(); + + info!( + sl!(), + "signal process"; + "container-id" => cid.clone(), + "exec-id" => eid.clone() + ); + let p = find_process(&mut sandbox, cid.as_str(), eid.as_str(), true)?; + + let mut signal = Signal::from_c_int(req.signal as i32).unwrap(); + + // For container initProcess, if it hasn't installed handler for "SIGTERM" signal, + // it will ignore the "SIGTERM" signal sent to it, thus send it "SIGKILL" signal + // instead of "SIGTERM" to terminate it. + if p.init && signal == Signal::SIGTERM && !is_signal_handled(p.pid, req.signal) { + signal = Signal::SIGKILL; + } + + p.signal(signal)?; + + Ok(()) + } + + fn do_wait_process( + &mut self, + req: protocols::agent::WaitProcessRequest, + ) -> Result { + let cid = req.container_id.clone(); + let eid = req.exec_id.clone(); + let s = Arc::clone(&self.sandbox); + let mut resp = WaitProcessResponse::new(); + let pid: pid_t; + let mut exit_pipe_r: RawFd = -1; + let mut buf: Vec = vec![0, 1]; + + info!( + sl!(), + "wait process"; + "container-id" => cid.clone(), + "exec-id" => eid.clone() + ); + + { + let mut sandbox = s.lock().unwrap(); + + let p = find_process(&mut sandbox, cid.as_str(), eid.as_str(), false)?; + + if p.exit_pipe_r.is_some() { + exit_pipe_r = p.exit_pipe_r.unwrap(); + } + + pid = p.pid; + } + + if exit_pipe_r != -1 { + info!(sl!(), "reading exit pipe"); + let _ = unistd::read(exit_pipe_r, buf.as_mut_slice()); + } + + let mut sandbox = s.lock().unwrap(); + let ctr = sandbox.get_container(cid.as_str()).unwrap(); + // need to close all fds + let mut p = ctr.processes.get_mut(&pid).unwrap(); + + if p.parent_stdin.is_some() { + let _ = unistd::close(p.parent_stdin.unwrap()); + } + + if p.parent_stdout.is_some() { + let _ = unistd::close(p.parent_stdout.unwrap()); + } + + if p.parent_stderr.is_some() { + let _ = unistd::close(p.parent_stderr.unwrap()); + } + + if p.term_master.is_some() { + let _ = unistd::close(p.term_master.unwrap()); + } + + if p.exit_pipe_r.is_some() { + let _ = unistd::close(p.exit_pipe_r.unwrap()); + } + + p.parent_stdin = None; + p.parent_stdout = None; + p.parent_stderr = None; + p.term_master = None; + + resp.status = p.exit_code; + + ctr.processes.remove(&pid); + + Ok(resp) + } + + fn do_write_stream( + &mut self, + req: protocols::agent::WriteStreamRequest, + ) -> Result { + let cid = req.container_id.clone(); + let eid = req.exec_id.clone(); + + info!( + sl!(), + "write stdin"; + "container-id" => cid.clone(), + "exec-id" => eid.clone() + ); + + let s = Arc::clone(&self.sandbox); + let mut sandbox = s.lock().unwrap(); + let p = find_process(&mut sandbox, cid.as_str(), eid.as_str(), false)?; + + // use ptmx io + let fd = if p.term_master.is_some() { + p.term_master.unwrap() + } else { + // use piped io + p.parent_stdin.unwrap() + }; + + let mut l = req.data.len(); + match unistd::write(fd, req.data.as_slice()) { + Ok(v) => { + if v < l { + /* + let f = sink.fail(RpcStatus::new( + RpcStatusCode::InvalidArgument, + Some(format!("write error")))) + .map_err(|_e| error!(sl!(), "write error")); + ctx.spawn(f); + return; + */ + info!(sl!(), "write {} bytes", v); + l = v; + } + } + Err(e) => match e { + nix::Error::Sys(nix::errno::Errno::EAGAIN) => l = 0, + _ => { + return Err( + ErrorKind::Nix(nix::Error::from_errno(nix::errno::Errno::EIO)).into(), + ); + } + }, + } + + let mut resp = WriteStreamResponse::new(); + resp.set_len(l as u32); + + Ok(resp) + } + + fn do_read_stream( + &mut self, + req: protocols::agent::ReadStreamRequest, + stdout: bool, + ) -> Result { + let cid = req.container_id; + let eid = req.exec_id; + + let mut fd: RawFd = -1; + info!(sl!(), "read stdout for {}/{}", cid.clone(), eid.clone()); + { + let s = Arc::clone(&self.sandbox); + let mut sandbox = s.lock().unwrap(); + + let p = find_process(&mut sandbox, cid.as_str(), eid.as_str(), false)?; + + if p.term_master.is_some() { + fd = p.term_master.unwrap(); + } else if stdout { + if p.parent_stdout.is_some() { + fd = p.parent_stdout.unwrap(); + } + } else { + fd = p.parent_stderr.unwrap(); + } + } + + if fd == -1 { + return Err(ErrorKind::Nix(nix::Error::from_errno(nix::errno::Errno::EINVAL)).into()); + } + + let vector = read_stream(fd, req.len as usize)?; + + let mut resp = ReadStreamResponse::new(); + resp.set_data(vector); + + Ok(resp) + } +} + +impl protocols::agent_grpc::AgentService for agentService { + fn create_container( + &mut self, + ctx: ::grpcio::RpcContext, + req: protocols::agent::CreateContainerRequest, + sink: ::grpcio::UnarySink, + ) { + if let Err(_) = self.do_create_container(req) { + let f = sink + .fail(RpcStatus::new( + RpcStatusCode::Internal, + Some("fail to create container".to_string()), + )) + .map_err(|_e| error!(sl!(), "container create fail")); + ctx.spawn(f); + return; + } else { + let resp = Empty::new(); + let f = sink + .success(resp) + .map_err(move |_e| error!(sl!(), "fail to create container")); + ctx.spawn(f); + } + } + + fn start_container( + &mut self, + ctx: ::grpcio::RpcContext, + req: protocols::agent::StartContainerRequest, + sink: ::grpcio::UnarySink, + ) { + if let Err(_) = self.do_start_container(req) { + let f = sink + .fail(RpcStatus::new( + RpcStatusCode::Internal, + Some("fail to find container".to_string()), + )) + .map_err(move |_e| error!(sl!(), "get container fail")); + ctx.spawn(f); + return; + } + + info!(sl!(), "exec process!\n"); + + let resp = Empty::new(); + let f = sink + .success(resp) + .map_err(move |_e| error!(sl!(), "fail to create container")); + ctx.spawn(f); + } + + fn remove_container( + &mut self, + ctx: ::grpcio::RpcContext, + req: protocols::agent::RemoveContainerRequest, + sink: ::grpcio::UnarySink, + ) { + if let Err(_) = self.do_remove_container(req) { + let f = sink + .fail(RpcStatus::new( + RpcStatusCode::Internal, + Some(String::from("fail to remove container")), + )) + .map_err(move |_e| error!(sl!(), "remove container failed")); + ctx.spawn(f); + } else { + let resp = Empty::new(); + let f = sink + .success(resp) + .map_err(|_e| error!(sl!(), "cannot destroy container")); + ctx.spawn(f); + } + } + fn exec_process( + &mut self, + ctx: ::grpcio::RpcContext, + req: protocols::agent::ExecProcessRequest, + sink: ::grpcio::UnarySink, + ) { + if let Err(_) = self.do_exec_process(req) { + let f = sink + .fail(RpcStatus::new( + RpcStatusCode::Internal, + Some(String::from("fail to exec process!")), + )) + .map_err(|_e| error!(sl!(), "fail to exec process!")); + ctx.spawn(f); + } else { + let resp = Empty::new(); + let f = sink + .success(resp) + .map_err(move |_e| error!(sl!(), "cannot exec process")); + ctx.spawn(f); + } + } + fn signal_process( + &mut self, + ctx: ::grpcio::RpcContext, + req: protocols::agent::SignalProcessRequest, + sink: ::grpcio::UnarySink, + ) { + if let Err(_) = self.do_signal_process(req) { + let f = sink + .fail(RpcStatus::new( + RpcStatusCode::Internal, + Some(String::from("fail to signal process!")), + )) + .map_err(|_e| error!(sl!(), "fail to signal process!")); + ctx.spawn(f); + } else { + let resp = Empty::new(); + let f = sink + .success(resp) + .map_err(|_e| error!(sl!(), "cannot signal process")); + ctx.spawn(f); + } + } + fn wait_process( + &mut self, + ctx: ::grpcio::RpcContext, + req: protocols::agent::WaitProcessRequest, + sink: ::grpcio::UnarySink, + ) { + if let Ok(resp) = self.do_wait_process(req) { + let f = sink + .success(resp) + .map_err(|_e| error!(sl!(), "cannot wait process")); + ctx.spawn(f); + } else { + let f = sink + .fail(RpcStatus::new( + RpcStatusCode::Internal, + Some(String::from("fail to wait process!")), + )) + .map_err(|_e| error!(sl!(), "fail to wait process!")); + ctx.spawn(f); + } + } + fn list_processes( + &mut self, + ctx: ::grpcio::RpcContext, + req: protocols::agent::ListProcessesRequest, + sink: ::grpcio::UnarySink, + ) { + let cid = req.container_id.clone(); + let format = req.format.clone(); + let mut args = req.args.clone().into_vec(); + let mut resp = ListProcessesResponse::new(); + + let s = Arc::clone(&self.sandbox); + let mut sandbox = s.lock().unwrap(); + + let ctr = sandbox.get_container(cid.as_str()).unwrap(); + let pids = ctr.processes().unwrap(); + + match format.as_str() { + "table" => {} + "json" => { + resp.process_list = serde_json::to_vec(&pids).unwrap(); + let f = sink + .success(resp) + .map_err(|_e| error!(sl!(), "cannot handle json resp")); + ctx.spawn(f); + return; + } + _ => { + let f = sink + .fail(RpcStatus::new( + RpcStatusCode::InvalidArgument, + Some(String::from("invalid format")), + )) + .map_err(|_e| error!(sl!(), "invalid format!")); + ctx.spawn(f); + return; + } + } + + // format "table" + if args.len() == 0 { + // default argument + args = vec!["-ef".to_string()]; + } + + let output = Command::new("ps") + .args(args.as_slice()) + .stdout(Stdio::piped()) + .output() + .expect("ps failed"); + + let out: String = String::from_utf8(output.stdout).unwrap(); + let mut lines: Vec = out.split('\n').map(|v| v.to_string()).collect(); + + let predicate = |v| { + if v == "PID" { + return true; + } else { + return false; + } + }; + + let pid_index = lines[0].split_whitespace().position(predicate).unwrap(); + + let mut result = String::new(); + result.push_str(lines[0].as_str()); + + lines.remove(0); + for line in &lines { + if line.trim().is_empty() { + continue; + } + + let fields: Vec = line.split_whitespace().map(|v| v.to_string()).collect(); + + if fields.len() < pid_index + 1 { + warn!(sl!(), "corrupted output?"); + continue; + } + let pid = fields[pid_index].trim().parse::().unwrap(); + + for p in &pids { + if pid == *p { + result.push_str(line.as_str()); + } + } + } + + resp.process_list = Vec::from(result); + + let f = sink + .success(resp) + .map_err(|_e| error!(sl!(), "list processes failed")); + ctx.spawn(f); + } + fn update_container( + &mut self, + ctx: ::grpcio::RpcContext, + req: protocols::agent::UpdateContainerRequest, + sink: ::grpcio::UnarySink, + ) { + let cid = req.container_id.clone(); + let res = req.resources.clone(); + + let s = Arc::clone(&self.sandbox); + let mut sandbox = s.lock().unwrap(); + + let ctr = sandbox.get_container(cid.as_str()).unwrap(); + + let resp = Empty::new(); + + if res.is_some() { + match ctr.set(res.unwrap()) { + Err(_e) => { + let f = sink + .fail(RpcStatus::new( + RpcStatusCode::Internal, + Some("internal error".to_string()), + )) + .map_err(|_e| error!(sl!(), "internal error!")); + ctx.spawn(f); + return; + } + + Ok(()) => {} + } + } + + let f = sink + .success(resp) + .map_err(|_e| error!(sl!(), "update container failed!")); + + ctx.spawn(f); + } + fn stats_container( + &mut self, + ctx: ::grpcio::RpcContext, + req: protocols::agent::StatsContainerRequest, + sink: ::grpcio::UnarySink, + ) { + let cid = req.container_id.clone(); + let s = Arc::clone(&self.sandbox); + let mut sandbox = s.lock().unwrap(); + + let ctr = sandbox.get_container(cid.as_str()).unwrap(); + + let resp = match ctr.stats() { + Err(_e) => { + let f = sink + .fail(RpcStatus::new( + RpcStatusCode::Internal, + Some("internal error!".to_string()), + )) + .map_err(|_e| error!(sl!(), "internal error!")); + ctx.spawn(f); + return; + } + + Ok(r) => r, + }; + + let f = sink + .success(resp) + .map_err(|_e| error!(sl!(), "stats containers failed!")); + ctx.spawn(f); + } + fn pause_container( + &mut self, + _ctx: ::grpcio::RpcContext, + _req: protocols::agent::PauseContainerRequest, + _sink: ::grpcio::UnarySink, + ) { + } + fn resume_container( + &mut self, + _ctx: ::grpcio::RpcContext, + _req: protocols::agent::ResumeContainerRequest, + _sink: ::grpcio::UnarySink, + ) { + } + fn write_stdin( + &mut self, + ctx: ::grpcio::RpcContext, + req: protocols::agent::WriteStreamRequest, + sink: ::grpcio::UnarySink, + ) { + if let Ok(resp) = self.do_write_stream(req) { + let f = sink + .success(resp) + .map_err(|_e| error!(sl!(), "writestream request failed!")); + + ctx.spawn(f); + } else { + let f = sink + .fail(RpcStatus::new( + RpcStatusCode::InvalidArgument, + Some(String::from("write stream failed")), + )) + .map_err(move |_e| error!(sl!(), "write stream failed")); + ctx.spawn(f); + } + } + fn read_stdout( + &mut self, + ctx: ::grpcio::RpcContext, + req: protocols::agent::ReadStreamRequest, + sink: ::grpcio::UnarySink, + ) { + if let Ok(resp) = self.do_read_stream(req, true) { + let f = sink + .success(resp) + .map_err(move |_e| error!(sl!(), "read stdout error!")); + + ctx.spawn(f); + } else { + let f = sink + .fail(RpcStatus::new( + RpcStatusCode::Internal, + Some(String::from("failed to read stdout")), + )) + .map_err(move |_e| error!(sl!(), "read stdout failed")); + ctx.spawn(f); + } + } + fn read_stderr( + &mut self, + ctx: ::grpcio::RpcContext, + req: protocols::agent::ReadStreamRequest, + sink: ::grpcio::UnarySink, + ) { + if let Ok(resp) = self.do_read_stream(req, false) { + let f = sink + .success(resp) + .map_err(move |_e| error!(sl!(), "read stderr error!")); + + ctx.spawn(f); + } else { + let f = sink + .fail(RpcStatus::new( + RpcStatusCode::Internal, + Some(String::from("failed to read stderr")), + )) + .map_err(move |_e| error!(sl!(), "read stderr failed")); + ctx.spawn(f); + } + } + fn close_stdin( + &mut self, + ctx: ::grpcio::RpcContext, + req: protocols::agent::CloseStdinRequest, + sink: ::grpcio::UnarySink, + ) { + let cid = req.container_id.clone(); + let eid = req.exec_id.clone(); + let s = Arc::clone(&self.sandbox); + let mut sandbox = s.lock().unwrap(); + + let p = match find_process(&mut sandbox, cid.as_str(), eid.as_str(), false) { + Ok(v) => v, + Err(_) => { + let f = sink + .fail(RpcStatus::new( + RpcStatusCode::InvalidArgument, + Some(String::from("invalid argument")), + )) + .map_err(|_e| error!(sl!(), "invalid argument")); + ctx.spawn(f); + return; + } + }; + + if p.term_master.is_some() { + let _ = unistd::close(p.term_master.unwrap()); + p.term_master = None; + } + + if p.parent_stdin.is_some() { + let _ = unistd::close(p.parent_stdin.unwrap()); + p.parent_stdin = None; + } + + let resp = Empty::new(); + + let f = sink + .success(resp) + .map_err(|_e| error!(sl!(), "close stdin failed")); + ctx.spawn(f); + } + + fn tty_win_resize( + &mut self, + ctx: ::grpcio::RpcContext, + req: protocols::agent::TtyWinResizeRequest, + sink: ::grpcio::UnarySink, + ) { + let cid = req.container_id.clone(); + let eid = req.exec_id.clone(); + let s = Arc::clone(&self.sandbox); + let mut sandbox = s.lock().unwrap(); + let p = find_process(&mut sandbox, cid.as_str(), eid.as_str(), false).unwrap(); + + if p.term_master.is_none() { + let f = sink + .fail(RpcStatus::new( + RpcStatusCode::Unavailable, + Some("no tty".to_string()), + )) + .map_err(|_e| error!(sl!(), "tty resize")); + ctx.spawn(f); + return; + } + + let fd = p.term_master.unwrap(); + unsafe { + let win = winsize { + ws_row: req.row as c_ushort, + ws_col: req.column as c_ushort, + ws_xpixel: 0, + ws_ypixel: 0, + }; + + let err = libc::ioctl(fd, TIOCSWINSZ, &win); + if let Err(_) = Errno::result(err).map(drop) { + let f = sink + .fail(RpcStatus::new( + RpcStatusCode::Internal, + Some("ioctl error".to_string()), + )) + .map_err(|_e| error!(sl!(), "ioctl error!")); + ctx.spawn(f); + return; + } + } + + let empty = protocols::empty::Empty::new(); + let f = sink + .success(empty) + .map_err(move |e| error!(sl!(), "failed to reply {:?}: {:?}", req, e)); + ctx.spawn(f) + } + fn update_interface( + &mut self, + ctx: ::grpcio::RpcContext, + req: protocols::agent::UpdateInterfaceRequest, + sink: ::grpcio::UnarySink, + ) { + let interface = req.interface.clone(); + let s = Arc::clone(&self.sandbox); + let mut sandbox = s.lock().unwrap(); + + if sandbox.rtnl.is_none() { + sandbox.rtnl = Some(RtnlHandle::new(NETLINK_ROUTE, 0).unwrap()); + } + + let rtnl = sandbox.rtnl.as_mut().unwrap(); + + let iface = match rtnl.update_interface(interface.as_ref().unwrap()) { + Ok(v) => v, + Err(_) => { + let f = sink + .fail(RpcStatus::new( + RpcStatusCode::Internal, + Some("update interface".to_string()), + )) + .map_err(|_e| error!(sl!(), "update interface")); + ctx.spawn(f); + return; + } + }; + + let f = sink + .success(iface) + .map_err(move |e| error!(sl!(), "failed to reply {:?}: {:?}", req, e)); + ctx.spawn(f) + } + fn update_routes( + &mut self, + ctx: ::grpcio::RpcContext, + req: protocols::agent::UpdateRoutesRequest, + sink: ::grpcio::UnarySink, + ) { + let mut routes = protocols::agent::Routes::new(); + let rs = req.routes.clone().unwrap().Routes.into_vec(); + + let s = Arc::clone(&self.sandbox); + let mut sandbox = s.lock().unwrap(); + + if sandbox.rtnl.is_none() { + sandbox.rtnl = Some(RtnlHandle::new(NETLINK_ROUTE, 0).unwrap()); + } + + let rtnl = sandbox.rtnl.as_mut().unwrap(); + // get current routes to return when error out + let crs = match rtnl.list_routes() { + Ok(routes) => routes, + Err(_) => { + let f = sink + .fail(RpcStatus::new( + RpcStatusCode::Internal, + Some("update routes".to_string()), + )) + .map_err(|_e| error!(sl!(), "update routes")); + ctx.spawn(f); + return; + } + }; + let v = match rtnl.update_routes(rs.as_ref()) { + Ok(value) => value, + Err(_) => crs, + }; + + routes.set_Routes(RepeatedField::from_vec(v)); + + let f = sink + .success(routes) + .map_err(move |e| error!(sl!(), "failed to reply {:?}: {:?}", req, e)); + + ctx.spawn(f) + } + fn list_interfaces( + &mut self, + ctx: ::grpcio::RpcContext, + req: protocols::agent::ListInterfacesRequest, + sink: ::grpcio::UnarySink, + ) { + let mut interface = protocols::agent::Interfaces::new(); + let s = Arc::clone(&self.sandbox); + let mut sandbox = s.lock().unwrap(); + + if sandbox.rtnl.is_none() { + sandbox.rtnl = Some(RtnlHandle::new(NETLINK_ROUTE, 0).unwrap()); + } + + let rtnl = sandbox.rtnl.as_mut().unwrap(); + let v = match rtnl.list_interfaces() { + Ok(value) => value, + Err(_) => { + let f = sink + .fail(RpcStatus::new( + RpcStatusCode::Internal, + Some("list interface".to_string()), + )) + .map_err(|_e| error!(sl!(), "list interface")); + ctx.spawn(f); + return; + } + }; + + interface.set_Interfaces(RepeatedField::from_vec(v)); + + let f = sink + .success(interface) + .map_err(move |e| error!(sl!(), "failed to reply {:?}: {:?}", req, e)); + ctx.spawn(f) + } + fn list_routes( + &mut self, + ctx: ::grpcio::RpcContext, + req: protocols::agent::ListRoutesRequest, + sink: ::grpcio::UnarySink, + ) { + let mut routes = protocols::agent::Routes::new(); + let s = Arc::clone(&self.sandbox); + let mut sandbox = s.lock().unwrap(); + + if sandbox.rtnl.is_none() { + sandbox.rtnl = Some(RtnlHandle::new(NETLINK_ROUTE, 0).unwrap()); + } + + let rtnl = sandbox.rtnl.as_mut().unwrap(); + + let v = match rtnl.list_routes() { + Ok(value) => value, + Err(_) => { + let f = sink + .fail(RpcStatus::new( + RpcStatusCode::Internal, + Some("list routes".to_string()), + )) + .map_err(|_e| error!(sl!(), "list routes")); + ctx.spawn(f); + return; + } + }; + + routes.set_Routes(RepeatedField::from_vec(v)); + + let f = sink + .success(routes) + .map_err(move |e| error!(sl!(), "failed to reply {:?}: {:?}", req, e)); + ctx.spawn(f) + } + fn start_tracing( + &mut self, + ctx: ::grpcio::RpcContext, + req: protocols::agent::StartTracingRequest, + sink: ::grpcio::UnarySink, + ) { + info!(sl!(), "start_tracing {:?} self.test={}", req, self.test); + self.test = 2; + let empty = protocols::empty::Empty::new(); + let f = sink + .success(empty) + .map_err(move |e| error!(sl!(), "failed to reply {:?}: {:?}", req, e)); + ctx.spawn(f) + } + fn stop_tracing( + &mut self, + ctx: ::grpcio::RpcContext, + req: protocols::agent::StopTracingRequest, + sink: ::grpcio::UnarySink, + ) { + let empty = protocols::empty::Empty::new(); + let f = sink + .success(empty) + .map_err(move |e| error!(sl!(), "failed to reply {:?}: {:?}", req, e)); + ctx.spawn(f) + } + fn create_sandbox( + &mut self, + ctx: ::grpcio::RpcContext, + req: protocols::agent::CreateSandboxRequest, + sink: ::grpcio::UnarySink, + ) { + let mut err = "".to_string(); + + { + let sandbox = self.sandbox.clone(); + let mut s = sandbox.lock().unwrap(); + + let _ = fs::remove_dir_all(CONTAINER_BASE); + let _ = fs::create_dir_all(CONTAINER_BASE); + + s.hostname = req.hostname.clone(); + s.running = true; + + if req.sandbox_id.len() > 0 { + s.id = req.sandbox_id.clone(); + } + + match s.setup_shared_namespaces() { + Ok(_) => (), + Err(e) => err = e.to_string(), + } + if err.len() != 0 { + let rpc_status = + grpcio::RpcStatus::new(grpcio::RpcStatusCode::FailedPrecondition, Some(err)); + let f = sink + .fail(rpc_status) + .map_err(move |e| error!(sl!(), "failed to reply {:?}: {:?}", req, e)); + ctx.spawn(f); + return; + } + } + + match add_storages(sl!(), req.storages.to_vec(), self.sandbox.clone()) { + Ok(m) => { + let sandbox = self.sandbox.clone(); + let mut s = sandbox.lock().unwrap(); + s.mounts = m + } + Err(e) => err = e.to_string(), + }; + + if err.len() != 0 { + let rpc_status = + grpcio::RpcStatus::new(grpcio::RpcStatusCode::FailedPrecondition, Some(err)); + let f = sink + .fail(rpc_status) + .map_err(move |e| error!(sl!(), "failed to reply {:?}: {:?}", req, e)); + ctx.spawn(f); + return; + } + + let empty = protocols::empty::Empty::new(); + let f = sink + .success(empty) + .map_err(move |e| error!(sl!(), "failed to reply {:?}: {:?}", req, e)); + ctx.spawn(f) + } + fn destroy_sandbox( + &mut self, + ctx: ::grpcio::RpcContext, + req: protocols::agent::DestroySandboxRequest, + sink: ::grpcio::UnarySink, + ) { + let s = Arc::clone(&self.sandbox); + let mut sandbox = s.lock().unwrap(); + // destroy all containers, clean up, notify agent to exit + // etc. + sandbox.destroy().unwrap(); + + sandbox.sender.as_ref().unwrap().send(1).unwrap(); + sandbox.sender = None; + + let empty = protocols::empty::Empty::new(); + let f = sink + .success(empty) + .map_err(move |e| error!(sl!(), "failed to reply {:?}: {:?}", req, e)); + ctx.spawn(f) + } + fn online_cpu_mem( + &mut self, + ctx: ::grpcio::RpcContext, + req: protocols::agent::OnlineCPUMemRequest, + sink: ::grpcio::UnarySink, + ) { + // sleep 5 seconds for debug + // thread::sleep(Duration::new(5, 0)); + let s = Arc::clone(&self.sandbox); + let sandbox = s.lock().unwrap(); + let empty = protocols::empty::Empty::new(); + + if let Err(_) = sandbox.online_cpu_memory(&req) { + let f = sink + .fail(RpcStatus::new( + RpcStatusCode::Internal, + Some("Internal error".to_string()), + )) + .map_err(|_e| error!(sl!(), "cannot online memory/cpu")); + ctx.spawn(f); + return; + } + + let f = sink + .success(empty) + .map_err(move |e| error!(sl!(), "failed to reply {:?}: {:?}", req, e)); + + ctx.spawn(f) + } + fn reseed_random_dev( + &mut self, + ctx: ::grpcio::RpcContext, + req: protocols::agent::ReseedRandomDevRequest, + sink: ::grpcio::UnarySink, + ) { + let empty = protocols::empty::Empty::new(); + if let Err(_) = random::reseed_rng(req.data.as_slice()) { + let f = sink + .fail(RpcStatus::new( + RpcStatusCode::Internal, + Some("Internal error".to_string()), + )) + .map_err(|_e| error!(sl!(), "fail to reseed rng!")); + ctx.spawn(f); + return; + } + + let f = sink + .success(empty) + .map_err(move |e| error!(sl!(), "failed to reply {:?}: {:?}", req, e)); + ctx.spawn(f) + } + fn get_guest_details( + &mut self, + ctx: ::grpcio::RpcContext, + req: protocols::agent::GuestDetailsRequest, + sink: ::grpcio::UnarySink, + ) { + info!(sl!(), "get guest details!"); + let mut resp = GuestDetailsResponse::new(); + // to get memory block size + match get_memory_info(req.mem_block_size, req.mem_hotplug_probe) { + Ok((u, v)) => { + resp.mem_block_size_bytes = u; + resp.support_mem_hotplug_probe = v; + } + + Err(_) => { + info!(sl!(), "fail to get memory info!"); + let f = sink + .fail(RpcStatus::new( + RpcStatusCode::Internal, + Some(String::from("internal error")), + )) + .map_err(|_e| error!(sl!(), "cannot get memory info!")); + ctx.spawn(f); + return; + } + } + + // to get agent details + let detail = get_agent_details(); + resp.agent_details = SingularPtrField::some(detail); + + let f = sink + .success(resp) + .map_err(|_e| error!(sl!(), "cannot get guest detail")); + ctx.spawn(f); + } + fn mem_hotplug_by_probe( + &mut self, + ctx: ::grpcio::RpcContext, + req: protocols::agent::MemHotplugByProbeRequest, + sink: ::grpcio::UnarySink, + ) { + let empty = protocols::empty::Empty::new(); + + if let Err(_) = do_mem_hotplug_by_probe(&req.memHotplugProbeAddr) { + let f = sink + .fail(RpcStatus::new( + RpcStatusCode::Internal, + Some("internal error!".to_string()), + )) + .map_err(|_e| error!(sl!(), "cannont mem hotplug by probe!")); + ctx.spawn(f); + return; + } + + let f = sink + .success(empty) + .map_err(move |e| error!(sl!(), "failed to reply {:?}: {:?}", req, e)); + ctx.spawn(f) + } + fn set_guest_date_time( + &mut self, + ctx: ::grpcio::RpcContext, + req: protocols::agent::SetGuestDateTimeRequest, + sink: ::grpcio::UnarySink, + ) { + let empty = protocols::empty::Empty::new(); + if let Err(_) = do_set_guest_date_time(req.Sec, req.Usec) { + let f = sink + .fail(RpcStatus::new( + RpcStatusCode::Internal, + Some("internal error!".to_string()), + )) + .map_err(|_e| error!(sl!(), "cannot set guest time!")); + ctx.spawn(f); + return; + } + + let f = sink + .success(empty) + .map_err(move |e| error!(sl!(), "failed to reply {:?}: {:?}", req, e)); + ctx.spawn(f) + } + fn copy_file( + &mut self, + ctx: ::grpcio::RpcContext, + req: protocols::agent::CopyFileRequest, + sink: ::grpcio::UnarySink, + ) { + let empty = protocols::empty::Empty::new(); + if let Err(_) = do_copy_file(&req) { + let f = sink + .fail(RpcStatus::new( + RpcStatusCode::Internal, + Some("Internal error!".to_string()), + )) + .map_err(|_e| error!(sl!(), "cannot copy file!")); + ctx.spawn(f); + return; + } + + let f = sink + .success(empty) + .map_err(move |e| error!(sl!(), "failed to reply {:?}: {:?}", req, e)); + ctx.spawn(f) + } +} + +#[derive(Clone)] +struct healthService; +impl protocols::health_grpc::Health for healthService { + fn check( + &mut self, + ctx: ::grpcio::RpcContext, + _req: protocols::health::CheckRequest, + sink: ::grpcio::UnarySink, + ) { + let mut resp = HealthCheckResponse::new(); + resp.set_status(HealthCheckResponse_ServingStatus::SERVING); + + let f = sink + .success(resp) + .map_err(|_e| error!(sl!(), "cannot get health status")); + + ctx.spawn(f); + } + fn version( + &mut self, + ctx: ::grpcio::RpcContext, + req: protocols::health::CheckRequest, + sink: ::grpcio::UnarySink, + ) { + info!(sl!(), "version {:?}", req); + let mut rep = protocols::health::VersionCheckResponse::new(); + rep.agent_version = AGENT_VERSION.to_string(); + rep.grpc_version = API_VERSION.to_string(); + let f = sink + .success(rep) + .map_err(move |e| error!(sl!(), "failed to reply {:?}: {:?}", req, e)); + ctx.spawn(f) + } +} + +fn get_memory_info(block_size: bool, hotplug: bool) -> Result<(u64, bool)> { + let mut size: u64 = 0; + let mut plug: bool = false; + if block_size { + match fs::read_to_string(SYSFS_MEMORY_BLOCK_SIZE_PATH) { + Ok(v) => { + if v.len() == 0 { + info!(sl!(), "string in empty???"); + return Err(ErrorKind::ErrorCode("Invalid block size".to_string()).into()); + } + + size = v.trim().parse::()?; + } + Err(e) => { + info!(sl!(), "memory block size error: {:?}", e.kind()); + if e.kind() != std::io::ErrorKind::NotFound { + return Err(ErrorKind::Io(e).into()); + } + } + } + } + + if hotplug { + match stat::stat(SYSFS_MEMORY_HOTPLUG_PROBE_PATH) { + Ok(_) => plug = true, + Err(e) => { + info!( + sl!(), + "hotplug memory error: {}", + e.as_errno().unwrap().desc() + ); + match e { + nix::Error::Sys(errno) => match errno { + Errno::ENOENT => plug = false, + _ => return Err(ErrorKind::Nix(e).into()), + }, + _ => return Err(ErrorKind::Nix(e).into()), + } + } + } + } + + Ok((size, plug)) +} + +fn get_agent_details() -> AgentDetails { + let mut detail = AgentDetails::new(); + + detail.set_version(AGENT_VERSION.to_string()); + detail.set_supports_seccomp(false); + detail.init_daemon = { unistd::getpid() == Pid::from_raw(1) }; + + detail.device_handlers = RepeatedField::new(); + detail.storage_handlers = RepeatedField::from_vec( + STORAGEHANDLERLIST + .keys() + .cloned() + .map(|x| x.into()) + .collect(), + ); + + detail +} + +fn read_stream(fd: RawFd, l: usize) -> Result> { + let mut v: Vec = Vec::with_capacity(l); + unsafe { + v.set_len(l); + } + + match unistd::read(fd, v.as_mut_slice()) { + Ok(len) => { + v.resize(len, 0); + // Rust didn't return an EOF error when the reading peer point + // was closed, instead it would return a 0 reading length, please + // see https://github.com/rust-lang/rfcs/blob/master/text/0517-io-os-reform.md#errors + if len == 0 { + return Err(ErrorKind::ErrorCode("read meet eof".to_string()).into()); + } + } + Err(e) => match e { + nix::Error::Sys(errno) => match errno { + Errno::EAGAIN => v.resize(0, 0), + _ => return Err(ErrorKind::Nix(nix::Error::Sys(errno)).into()), + }, + _ => return Err(ErrorKind::ErrorCode("read error".to_string()).into()), + }, + } + + Ok(v) +} + +fn find_process<'a>( + sandbox: &'a mut Sandbox, + cid: &'a str, + eid: &'a str, + init: bool, +) -> Result<&'a mut Process> { + let ctr = match sandbox.get_container(cid) { + Some(v) => v, + None => return Err(ErrorKind::ErrorCode(String::from("Invalid container id")).into()), + }; + + if init && eid == "" { + let p = match ctr.processes.get_mut(&ctr.init_process_pid) { + Some(v) => v, + None => { + return Err(ErrorKind::ErrorCode(String::from("cannot find init process!")).into()) + } + }; + + return Ok(p); + } + + let p = match ctr.get_process(eid) { + Ok(v) => v, + Err(_) => return Err(ErrorKind::ErrorCode("Invalid exec id".to_string()).into()), + }; + + Ok(p) +} + +pub fn start>(sandbox: Arc>, host: S, port: u16) -> Server { + let env = Arc::new( + EnvBuilder::new() + .cq_count(1) + .wait_thread_count_default(5) + .wait_thread_count_min(1) + .wait_thread_count_max(10) + .build(), + ); + let worker = agentService { + sandbox: sandbox, + test: 1, + }; + let service = protocols::agent_grpc::create_agent_service(worker); + let hservice = protocols::health_grpc::create_health(healthService); + let mut server = ServerBuilder::new(env) + .register_service(service) + .register_service(hservice) + .requests_slot_per_cq(1024) + .bind(host, port) + .build() + .unwrap(); + server.start(); + info!(sl!(), "gRPC server started"); + for &(ref host, port) in server.bind_addrs() { + info!(sl!(), "listening"; "host" => host, + "port" => port); + } + + server +} + +// This function updates the container namespaces configuration based on the +// sandbox information. When the sandbox is created, it can be setup in a way +// that all containers will share some specific namespaces. This is the agent +// responsibility to create those namespaces so that they can be shared across +// several containers. +// If the sandbox has not been setup to share namespaces, then we assume all +// containers will be started in their own new namespace. +// The value of a.sandbox.sharedPidNs.path will always override the namespace +// path set by the spec, since we will always ignore it. Indeed, it makes no +// sense to rely on the namespace path provided by the host since namespaces +// are different inside the guest. +fn update_container_namespaces(sandbox: &Sandbox, spec: &mut Spec) -> Result<()> { + let linux = match spec.Linux.as_mut() { + None => { + return Err( + ErrorKind::ErrorCode("Spec didn't container linux field".to_string()).into(), + ) + } + Some(l) => l, + }; + + let mut pidNs = false; + + let namespaces = linux.Namespaces.as_mut_slice(); + for namespace in namespaces.iter_mut() { + if namespace.Type == NSTYPEPID { + pidNs = true; + continue; + } + if namespace.Type == NSTYPEIPC { + namespace.Path = sandbox.shared_ipcns.path.clone(); + continue; + } + if namespace.Type == NSTYPEUTS { + namespace.Path = sandbox.shared_utsns.path.clone(); + continue; + } + } + + if !pidNs && !sandbox.sandbox_pid_ns { + let mut pid_ns = LinuxNamespace::new(); + pid_ns.set_Type(NSTYPEPID.to_string()); + linux.Namespaces.push(pid_ns); + } + + Ok(()) +} + +// Check is the container process installed the +// handler for specific signal. +fn is_signal_handled(pid: pid_t, signum: u32) -> bool { + let sig_mask: u64 = 1u64 << (signum - 1); + let file_name = format!("/proc/{}/status", pid); + + // Open the file in read-only mode (ignoring errors). + let file = match File::open(&file_name) { + Ok(f) => f, + Err(_) => { + warn!(sl!(), "failed to open file {}\n", file_name); + return false; + } + }; + + let reader = BufReader::new(file); + + // Read the file line by line using the lines() iterator from std::io::BufRead. + for (_index, line) in reader.lines().enumerate() { + let line = match line { + Ok(l) => l, + Err(_) => { + warn!(sl!(), "failed to read file {}\n", file_name); + return false; + } + }; + if line.starts_with("SigCgt:") { + let mask_vec: Vec<&str> = line.split(":").collect(); + if mask_vec.len() != 2 { + warn!(sl!(), "parse the SigCgt field failed\n"); + return false; + } + let sig_cgt_str = mask_vec[1]; + let sig_cgt_mask = match u64::from_str_radix(sig_cgt_str, 16) { + Ok(h) => h, + Err(_) => { + warn!(sl!(), "failed to parse the str {} to hex\n", sig_cgt_str); + return false; + } + }; + + return (sig_cgt_mask & sig_mask) == sig_mask; + } + } + false +} + +fn do_mem_hotplug_by_probe(addrs: &Vec) -> Result<()> { + for addr in addrs.iter() { + fs::write(SYSFS_MEMORY_HOTPLUG_PROBE_PATH, format!("{:#X}", *addr))?; + } + Ok(()) +} + +fn do_set_guest_date_time(sec: i64, usec: i64) -> Result<()> { + let tv = libc::timeval { + tv_sec: sec, + tv_usec: usec, + }; + + let ret = + unsafe { libc::settimeofday(&tv as *const libc::timeval, 0 as *const libc::timezone) }; + + Errno::result(ret).map(drop)?; + + Ok(()) +} + +fn do_copy_file(req: &CopyFileRequest) -> Result<()> { + let path = fs::canonicalize(req.path.as_str())?; + + if !path.starts_with(CONTAINER_BASE) { + return Err(nix::Error::Sys(Errno::EINVAL).into()); + } + + let parent = path.parent(); + + let dir = if parent.is_some() { + parent.unwrap().to_path_buf() + } else { + PathBuf::from("/") + }; + + if let Err(e) = fs::create_dir_all(dir.to_str().unwrap()) { + if e.kind() != std::io::ErrorKind::AlreadyExists { + return Err(e.into()); + } + } + + let ret = unsafe { + libc::chmod( + dir.to_str().unwrap().as_ptr() as *const libc::c_char, + req.dir_mode, + ) + }; + + let _ = Errno::result(ret).map(drop)?; + + let mut tmpfile = path.clone(); + tmpfile.set_extension("tmp"); + + let file = OpenOptions::new() + .write(true) + .create(true) + .truncate(false) + .open(tmpfile.to_str().unwrap())?; + file.write_all_at(req.data.as_slice(), req.offset as u64)?; + + let st = stat::stat(tmpfile.to_str().unwrap())?; + + if st.st_size != req.file_size { + return Ok(()); + } + + let ret = unsafe { + libc::chmod( + tmpfile.to_str().unwrap().as_ptr() as *const libc::c_char, + req.file_mode, + ) + }; + + let _ = Errno::result(ret).map(drop)?; + unistd::chown( + tmpfile.to_str().unwrap(), + Some(Uid::from_raw(req.uid as u32)), + Some(Gid::from_raw(req.gid as u32)), + )?; + + fs::rename(tmpfile, path)?; + + Ok(()) +} + +fn setup_bundle(gspec: &Spec) -> Result<()> { + if gspec.Root.is_none() { + return Err(nix::Error::Sys(Errno::EINVAL).into()); + } + let root = gspec.Root.as_ref().unwrap().Path.as_str(); + + let rootfs = fs::canonicalize(root)?; + let bundle_path = rootfs.parent().unwrap().to_str().unwrap(); + + let config = format!("{}/{}", bundle_path, "config.json"); + + let oci = rustjail::grpc_to_oci(gspec); + info!( + sl!(), + "{:?}", + oci.process.as_ref().unwrap().console_size.as_ref() + ); + let _ = oci.save(config.as_str()); + + unistd::chdir(bundle_path)?; + + Ok(()) +} diff --git a/src/agent/src/logging.rs b/src/agent/src/logging.rs new file mode 100644 index 0000000000..e6a93ff0fd --- /dev/null +++ b/src/agent/src/logging.rs @@ -0,0 +1,260 @@ +// Copyright (c) 2019 Intel Corporation +// +// SPDX-License-Identifier: Apache-2.0 +// + +use slog::{BorrowedKV, Drain, Key, OwnedKV, OwnedKVList, Record, KV}; +use std::collections::HashMap; +use std::io; +use std::io::Write; +use std::process; +use std::result; +use std::sync::{Arc, Mutex}; + +// XXX: 'writer' param used to make testing possible. +pub fn create_logger(name: &str, source: &str, level: slog::Level, writer: W) -> slog::Logger +where + W: Write + Send + Sync + 'static, +{ + let json_drain = slog_json::Json::new(writer) + .add_default_keys() + .build() + .fuse(); + + // Ensure only a unique set of key/value fields is logged + let unique_drain = UniqueDrain::new(json_drain).fuse(); + + // Allow runtime filtering of records by log level + let filter_drain = RuntimeLevelFilter::new(unique_drain, level).fuse(); + + // Ensure the logger is thread-safe + let async_drain = slog_async::Async::new(filter_drain).build().fuse(); + + // Add some "standard" fields + slog::Logger::root( + async_drain.fuse(), + o!("version" => env!("CARGO_PKG_VERSION"), + "subsystem" => "root", + "pid" => process::id().to_string(), + "name" => name.to_string(), + "source" => source.to_string()), + ) +} + +impl KV for HashSerializer { + fn serialize(&self, _record: &Record, serializer: &mut dyn slog::Serializer) -> slog::Result { + for (key, value) in self.fields.clone().into_iter() { + serializer.emit_str(Key::from(key), &value)?; + } + + Ok(()) + } +} + +// Used to convert an slog::OwnedKVList into a hash map. +struct HashSerializer { + fields: HashMap, +} + +impl HashSerializer { + fn new() -> HashSerializer { + HashSerializer { + fields: HashMap::new(), + } + } + + fn add_field(&mut self, key: String, value: String) { + // Take care to only add the first instance of a key. This matters for loggers (but not + // Records) since a child loggers have parents and the loggers are serialised child first + // meaning the *newest* fields are serialised first. + if !self.fields.contains_key(&key) { + self.fields.insert(key, value); + } + } + + fn remove_field(&mut self, key: &str) { + self.fields.remove(key); + } +} + +impl slog::Serializer for HashSerializer { + fn emit_arguments(&mut self, key: Key, value: &std::fmt::Arguments) -> slog::Result { + self.add_field(format!("{}", key), format!("{}", value)); + Ok(()) + } +} + +struct UniqueDrain { + drain: D, +} + +impl UniqueDrain { + fn new(drain: D) -> Self { + UniqueDrain { drain: drain } + } +} + +impl Drain for UniqueDrain +where + D: slog::Drain, +{ + type Ok = (); + type Err = io::Error; + + fn log(&self, record: &Record, values: &OwnedKVList) -> Result { + let mut logger_serializer = HashSerializer::new(); + values.serialize(record, &mut logger_serializer)?; + + let mut record_serializer = HashSerializer::new(); + record.kv().serialize(record, &mut record_serializer)?; + + for (key, _) in record_serializer.fields.iter() { + logger_serializer.remove_field(key); + } + + let record_owned_kv = OwnedKV(record_serializer); + let record_static = record_static!(record.level(), ""); + let new_record = Record::new(&record_static, record.msg(), BorrowedKV(&record_owned_kv)); + + let logger_owned_kv = OwnedKV(logger_serializer); + + let result = self + .drain + .log(&new_record, &OwnedKVList::from(logger_owned_kv)); + + match result { + Ok(_t) => Ok(()), + Err(_e) => Err(std::io::Error::new( + std::io::ErrorKind::Other, + "failed to drain log".to_string(), + )), + } + } +} + +// A RuntimeLevelFilter will discard all log records whose log level is less than the level +// specified in the struct. +struct RuntimeLevelFilter { + drain: D, + level: Arc>, +} + +impl RuntimeLevelFilter { + fn new(drain: D, level: slog::Level) -> Self { + RuntimeLevelFilter { + drain: drain, + level: Arc::new(Mutex::new(level)), + } + } + + fn set_level(&self, level: slog::Level) { + let level_ref = self.level.clone(); + + let mut log_level = level_ref.lock().unwrap(); + + *log_level = level; + } +} + +impl Drain for RuntimeLevelFilter +where + D: Drain, +{ + type Ok = Option; + type Err = Option; + + fn log( + &self, + record: &slog::Record, + values: &slog::OwnedKVList, + ) -> result::Result { + let level_ref = self.level.clone(); + + let log_level = level_ref.lock().unwrap(); + + if record.level().is_at_least(*log_level) { + self.drain.log(record, values)?; + } + + Ok(None) + } +} + +#[cfg(test)] +mod tests { + use super::*; + use serde_json::Value; + use std::io::prelude::*; + use tempfile::NamedTempFile; + + #[test] + fn test_create_logger_write_to_tmpfile() { + // Create a writer for the logger drain to use + let writer = NamedTempFile::new().expect("failed to create tempfile"); + + // Used to check file contents before the temp file is unlinked + let mut writer_ref = writer.reopen().expect("failed to clone tempfile"); + + let level = slog::Level::Trace; + let name = "name"; + let source = "source"; + let record_subsystem = "record-subsystem"; + + let record_key = "record-key-1"; + let record_value = "record-key-2"; + + let logger = create_logger(name, source, level, writer); + + let msg = "foo, bar, baz"; + + // Call the logger (which calls the drain) + info!(logger, "{}", msg; "subsystem" => record_subsystem, record_key => record_value); + + // Force temp file to be flushed + drop(logger); + + let mut contents = String::new(); + writer_ref + .read_to_string(&mut contents) + .expect("failed to read tempfile contents"); + + // Convert file to JSON + let fields: Value = + serde_json::from_str(&contents).expect("failed to convert logfile to json"); + + // Check the expected JSON fields + + let field_ts = fields.get("ts").expect("failed to find timestamp field"); + assert_ne!(field_ts, ""); + + let field_version = fields.get("version").expect("failed to find version field"); + assert_eq!(field_version, env!("CARGO_PKG_VERSION")); + + let field_pid = fields.get("pid").expect("failed to find pid field"); + assert_ne!(field_pid, ""); + + let field_level = fields.get("level").expect("failed to find level field"); + assert_eq!(field_level, "INFO"); + + let field_msg = fields.get("msg").expect("failed to find msg field"); + assert_eq!(field_msg, msg); + + let field_name = fields.get("name").expect("failed to find name field"); + assert_eq!(field_name, name); + + let field_source = fields.get("source").expect("failed to find source field"); + assert_eq!(field_source, source); + + let field_subsystem = fields + .get("subsystem") + .expect("failed to find subsystem field"); + + // The records field should take priority over the loggers field of the same name + assert_eq!(field_subsystem, record_subsystem); + + let field_record_value = fields + .get(record_key) + .expect("failed to find record key field"); + assert_eq!(field_record_value, record_value); + } +} diff --git a/src/agent/src/main.rs b/src/agent/src/main.rs new file mode 100644 index 0000000000..a4519936d9 --- /dev/null +++ b/src/agent/src/main.rs @@ -0,0 +1,561 @@ +// Copyright (c) 2019 Ant Financial +// +// SPDX-License-Identifier: Apache-2.0 +// + +#![allow(non_camel_case_types)] +#![allow(unused_parens)] +#![allow(unused_unsafe)] +#![allow(dead_code)] +#![allow(non_snake_case)] +#[macro_use] +extern crate lazy_static; +extern crate prctl; +extern crate protocols; +extern crate regex; +extern crate rustjail; +extern crate serde_json; +extern crate signal_hook; +#[macro_use] +extern crate scan_fmt; +extern crate oci; + +#[macro_use] +extern crate slog; +extern crate slog_async; +extern crate slog_json; + +use futures::*; +use nix::sys::wait::{self, WaitStatus}; +use nix::unistd; +use prctl::set_child_subreaper; +use rustjail::errors::*; +use signal_hook::{iterator::Signals, SIGCHLD}; +use std::collections::HashMap; +use std::env; +use std::fs; +use std::os::unix::fs::{self as unixfs}; +use std::os::unix::io::AsRawFd; +use std::path::Path; +use std::sync::mpsc::{self, Sender}; +use std::sync::{Arc, Mutex}; +use std::{io, thread}; +use unistd::Pid; + +mod device; +mod logging; +mod mount; +mod namespace; +pub mod netlink; +mod network; +pub mod random; +mod sandbox; +mod uevent; +mod version; + +use mount::{cgroups_mount, general_mount}; +use sandbox::Sandbox; +use slog::Logger; +use uevent::watch_uevents; + +mod grpc; + +const NAME: &'static str = "kata-agent"; +const VSOCK_ADDR: &'static str = "vsock://-1"; +const VSOCK_PORT: u16 = 1024; + +lazy_static! { + static ref GLOBAL_DEVICE_WATCHER: Arc>>> = + Arc::new(Mutex::new(HashMap::new())); +} + +use std::mem::MaybeUninit; + +fn announce(logger: &Logger) { + let commit = match env::var("VERSION_COMMIT") { + Ok(s) => s, + Err(_) => String::from(""), + }; + info!(logger, "announce"; + "agent-commit" => commit.as_str(), + "agent-version" => version::AGENT_VERSION, + "api-version" => version::API_VERSION, + ); +} + +fn main() -> Result<()> { + let writer = io::stdout(); + let logger = logging::create_logger(NAME, "agent", slog::Level::Info, writer); + + announce(&logger); + + // This "unused" variable is required as it enables the global (and crucially static) logger, + // which is required to satisfy the the lifetime constraints of the auto-generated gRPC code. + let _guard = slog_scope::set_global_logger(logger.new(o!("subsystem" => "grpc"))); + + env::set_var("RUST_BACKTRACE", "full"); + + lazy_static::initialize(&SHELLS); + parse_cmdline(KERNEL_CMDLINE_FILE)?; + + let shells = SHELLS.clone(); + + let shell_handle = if unsafe { DEBUG_CONSOLE } { + let thread_logger = logger.clone(); + + thread::spawn(move || { + let shells = shells.lock().unwrap(); + let result = setup_debug_console(shells.to_vec()); + if result.is_err() { + // Report error, but don't fail + warn!(thread_logger, "failed to setup debug console"; + "error" => format!("{}", result.unwrap_err())); + } + }) + } else { + unsafe { MaybeUninit::zeroed().assume_init() } + }; + + if unistd::getpid() == Pid::from_raw(1) { + init_agent_as_init(&logger)?; + } + + // Initialize unique sandbox structure. + let s = Sandbox::new(&logger).map_err(|e| { + error!(logger, "Failed to create sandbox with error: {:?}", e); + e + })?; + + let sandbox = Arc::new(Mutex::new(s)); + + setup_signal_handler(&logger, sandbox.clone()).unwrap(); + watch_uevents(sandbox.clone()); + + let (tx, rx) = mpsc::channel::(); + sandbox.lock().unwrap().sender = Some(tx); + + //vsock:///dev/vsock, port + let mut server = grpc::start(sandbox.clone(), VSOCK_ADDR, VSOCK_PORT); + + /* + let _ = fs::remove_file("/tmp/testagent"); + let _ = fs::remove_dir_all("/run/agent"); + let mut server = grpc::start(sandbox.clone(), "unix:///tmp/testagent", 1); + */ + + let handle = thread::spawn(move || { + // info!("Press ENTER to exit..."); + // let _ = io::stdin().read(&mut [0]).unwrap(); + // thread::sleep(Duration::from_secs(3000)); + + let _ = rx.recv().unwrap(); + }); + // receive something from destroy_sandbox here? + // or in the thread above? It depneds whether grpc request + // are run in another thread or in the main thead? + // let _ = rx.wait(); + + handle.join().unwrap(); + + if unsafe { DEBUG_CONSOLE } { + shell_handle.join().unwrap(); + } + + let _ = server.shutdown().wait(); + let _ = fs::remove_file("/tmp/testagent"); + + Ok(()) +} + +use nix::sys::wait::WaitPidFlag; + +fn setup_signal_handler(logger: &Logger, sandbox: Arc>) -> Result<()> { + let logger = logger.new(o!("subsystem" => "signals")); + + set_child_subreaper(true).map_err(|err| { + format!( + "failed to setup agent as a child subreaper, failed with {}", + err + ) + })?; + + let signals = Signals::new(&[SIGCHLD])?; + + let s = sandbox.clone(); + + thread::spawn(move || { + 'outer: for sig in signals.forever() { + info!(logger, "received signal"; "signal" => sig); + + // sevral signals can be combined together + // as one. So loop around to reap all + // exited children + 'inner: loop { + let wait_status = match wait::waitpid( + Some(Pid::from_raw(-1)), + Some(WaitPidFlag::WNOHANG | WaitPidFlag::__WALL), + ) { + Ok(s) => { + if s == WaitStatus::StillAlive { + continue 'outer; + } + s + } + Err(e) => { + info!( + logger, + "waitpid reaper failed"; + "error" => e.as_errno().unwrap().desc() + ); + continue 'outer; + } + }; + + let pid = wait_status.pid(); + if pid.is_some() { + let raw_pid = pid.unwrap().as_raw(); + let child_pid = format!("{}", raw_pid); + + let logger = logger.new(o!("child-pid" => child_pid)); + + let mut sandbox = s.lock().unwrap(); + let process = sandbox.find_process(raw_pid); + if process.is_none() { + info!(logger, "child exited unexpectedly"); + continue 'inner; + } + + let mut p = process.unwrap(); + + if p.exit_pipe_w.is_none() { + error!(logger, "the process's exit_pipe_w isn't set"); + continue 'inner; + } + let pipe_write = p.exit_pipe_w.unwrap(); + let ret: i32; + + match wait_status { + WaitStatus::Exited(_, c) => ret = c, + WaitStatus::Signaled(_, sig, _) => ret = sig as i32, + _ => { + info!(logger, "got wrong status for process"; + "child-status" => format!("{:?}", wait_status)); + continue 'inner; + } + } + + p.exit_code = ret; + let _ = unistd::close(pipe_write); + } + } + } + }); + Ok(()) +} + +// init_agent_as_init will do the initializations such as setting up the rootfs +// when this agent has been run as the init process. +fn init_agent_as_init(logger: &Logger) -> Result<()> { + general_mount(logger)?; + cgroups_mount(logger)?; + + fs::remove_file(Path::new("/dev/ptmx"))?; + unixfs::symlink(Path::new("/dev/pts/ptmx"), Path::new("/dev/ptmx"))?; + + unistd::setsid()?; + + unsafe { + libc::ioctl(io::stdin().as_raw_fd(), libc::TIOCSCTTY, 1); + } + + env::set_var("PATH", "/bin:/sbin/:/usr/bin/:/usr/sbin/"); + + Ok(()) +} + +const LOG_LEVEL_FLAG: &'static str = "agent.log"; +const DEV_MODE_FLAG: &'static str = "agent.devmode"; +const TRACE_MODE_FLAG: &'static str = "agent.trace"; +const USE_VSOCK_FLAG: &'static str = "agent.use_vsock"; +const DEBUG_CONSOLE_FLAG: &'static str = "agent.debug_console"; +const KERNEL_CMDLINE_FILE: &'static str = "/proc/cmdline"; +const CONSOLE_PATH: &'static str = "/dev/console"; + +lazy_static! { + static ref SHELLS: Arc>> = { + let mut v = Vec::new(); + + if !cfg!(test) { + v.push("/bin/bash".to_string()); + v.push("/bin/sh".to_string()); + } + + Arc::new(Mutex::new(v)) + }; +} + +pub static mut DEBUG_CONSOLE: bool = false; +// pub static mut LOG_LEVEL: ; +pub static mut DEV_MODE: bool = false; +// pub static mut TRACE_MODE: ; + +fn parse_cmdline(file: &str) -> Result<()> { + let cmdline = fs::read_to_string(file)?; + let params: Vec<&str> = cmdline.split_ascii_whitespace().collect(); + for param in params.iter() { + if param.starts_with(DEBUG_CONSOLE_FLAG) { + unsafe { + DEBUG_CONSOLE = true; + } + } + + if param.starts_with(DEV_MODE_FLAG) { + unsafe { + DEV_MODE = true; + } + } + } + + Ok(()) +} + +use nix::fcntl::{self, OFlag}; +use nix::sys::stat::Mode; +use std::os::unix::io::{FromRawFd, RawFd}; +use std::path::PathBuf; +use std::process::{Command, Stdio}; + +fn setup_debug_console(shells: Vec) -> Result<()> { + for shell in shells.iter() { + let binary = PathBuf::from(shell); + if binary.exists() { + let f: RawFd = fcntl::open(CONSOLE_PATH, OFlag::O_RDWR, Mode::empty())?; + let cmd = Command::new(shell) + .stdin(unsafe { Stdio::from_raw_fd(f) }) + .stdout(unsafe { Stdio::from_raw_fd(f) }) + .stderr(unsafe { Stdio::from_raw_fd(f) }) + .spawn(); + + let mut cmd = match cmd { + Ok(c) => c, + Err(_) => { + return Err(ErrorKind::ErrorCode("failed to spawn shell".to_string()).into()) + } + }; + + cmd.wait()?; + + return Ok(()); + } else { + return Err(ErrorKind::ErrorCode("invalid shell".to_string()).into()); + } + } + + Err(ErrorKind::ErrorCode("no shell".to_string()).into()) +} + +#[cfg(test)] +mod tests { + use super::*; + use std::fs::File; + use std::io::Write; + use tempfile::tempdir; + + #[test] + fn test_setup_debug_console_no_shells() { + // Guarantee no shells have been added + // (required to avoid racing with + // test_setup_debug_console_invalid_shell()). + let shells_ref = SHELLS.clone(); + let mut shells = shells_ref.lock().unwrap(); + shells.clear(); + + let result = setup_debug_console(shells.to_vec()); + + assert!(result.is_err()); + assert_eq!(result.unwrap_err().to_string(), "Error Code: 'no shell'"); + } + + #[test] + fn test_setup_debug_console_invalid_shell() { + let shells_ref = SHELLS.clone(); + let mut shells = shells_ref.lock().unwrap(); + + let dir = tempdir().expect("failed to create tmpdir"); + + // Add an invalid shell + let shell = dir + .path() + .join("enoent") + .to_str() + .expect("failed to construct shell path") + .to_string(); + + shells.push(shell); + + let result = setup_debug_console(shells.to_vec()); + + assert!(result.is_err()); + assert_eq!( + result.unwrap_err().to_string(), + "Error Code: 'invalid shell'" + ); + } + + #[test] + fn test_parse_cmdline() { + #[derive(Debug)] + struct TestData<'a> { + contents: &'a str, + debug_console: bool, + dev_mode: bool, + } + + let tests = &[ + TestData { + contents: "", + debug_console: false, + dev_mode: false, + }, + TestData { + contents: "foo", + debug_console: false, + dev_mode: false, + }, + TestData { + contents: "foo bar", + debug_console: false, + dev_mode: false, + }, + TestData { + contents: "foo bar", + debug_console: false, + dev_mode: false, + }, + TestData { + contents: "foo agent bar", + debug_console: false, + dev_mode: false, + }, + TestData { + contents: "foo debug_console agent bar devmode", + debug_console: false, + dev_mode: false, + }, + TestData { + contents: "agent.debug_console", + debug_console: true, + dev_mode: false, + }, + TestData { + contents: " agent.debug_console ", + debug_console: true, + dev_mode: false, + }, + TestData { + contents: "agent.debug_console foo", + debug_console: true, + dev_mode: false, + }, + TestData { + contents: " agent.debug_console foo", + debug_console: true, + dev_mode: false, + }, + TestData { + contents: "foo agent.debug_console bar", + debug_console: true, + dev_mode: false, + }, + TestData { + contents: "foo agent.debug_console", + debug_console: true, + dev_mode: false, + }, + TestData { + contents: "foo agent.debug_console ", + debug_console: true, + dev_mode: false, + }, + TestData { + contents: "agent.devmode", + debug_console: false, + dev_mode: true, + }, + TestData { + contents: " agent.devmode ", + debug_console: false, + dev_mode: true, + }, + TestData { + contents: "agent.devmode foo", + debug_console: false, + dev_mode: true, + }, + TestData { + contents: " agent.devmode foo", + debug_console: false, + dev_mode: true, + }, + TestData { + contents: "foo agent.devmode bar", + debug_console: false, + dev_mode: true, + }, + TestData { + contents: "foo agent.devmode", + debug_console: false, + dev_mode: true, + }, + TestData { + contents: "foo agent.devmode ", + debug_console: false, + dev_mode: true, + }, + TestData { + contents: "agent.devmode agent.debug_console", + debug_console: true, + dev_mode: true, + }, + ]; + + let dir = tempdir().expect("failed to create tmpdir"); + + // First, check a missing file is handled + let file_path = dir.path().join("enoent"); + + let filename = file_path.to_str().expect("failed to create filename"); + + let result = parse_cmdline(&filename.to_owned()); + assert!(result.is_err()); + + // Now, test various combinations of file contents + for (i, d) in tests.iter().enumerate() { + // Reset + unsafe { + DEBUG_CONSOLE = false; + DEV_MODE = false; + }; + + let msg = format!("test[{}]: {:?}", i, d); + + let file_path = dir.path().join("cmdline"); + + let filename = file_path.to_str().expect("failed to create filename"); + + let mut file = + File::create(filename).expect(&format!("{}: failed to create file", msg)); + + file.write_all(d.contents.as_bytes()) + .expect(&format!("{}: failed to write file contents", msg)); + + let result = parse_cmdline(filename); + assert!(result.is_ok(), "{}", msg); + + unsafe { + assert_eq!(d.debug_console, DEBUG_CONSOLE, "{}", msg); + assert_eq!(d.dev_mode, DEV_MODE, "{}", msg); + }; + } + } +} diff --git a/src/agent/src/mount.rs b/src/agent/src/mount.rs new file mode 100644 index 0000000000..b3e594045c --- /dev/null +++ b/src/agent/src/mount.rs @@ -0,0 +1,1296 @@ +// Copyright (c) 2019 Ant Financial +// +// SPDX-License-Identifier: Apache-2.0 +// + +use rustjail::errors::*; +use std::collections::HashMap; +use std::ffi::CString; +use std::fs; +use std::io; +use std::iter::FromIterator; +use std::os::unix::fs::PermissionsExt; + +use std::path::Path; +use std::ptr::null; +use std::sync::{Arc, Mutex}; + +use libc::{c_void, mount}; +use nix::mount::{self, MsFlags}; + +use regex::Regex; +use std::fs::File; +use std::io::{BufRead, BufReader}; + +use crate::device::{get_pci_device_name, get_scsi_device_name, online_device}; +use crate::protocols::agent::Storage; +use crate::Sandbox; +use slog::Logger; + +const DRIVER9PTYPE: &'static str = "9p"; +const DRIVERVIRTIOFSTYPE: &'static str = "virtio-fs"; +pub const DRIVERBLKTYPE: &'static str = "blk"; +pub const DRIVERMMIOBLKTYPE: &'static str = "mmioblk"; +pub const DRIVERSCSITYPE: &'static str = "scsi"; +pub const DRIVERNVDIMMTYPE: &'static str = "nvdimm"; +const DRIVEREPHEMERALTYPE: &'static str = "ephemeral"; +const DRIVERLOCALTYPE: &'static str = "local"; + +pub const TYPEROOTFS: &'static str = "rootfs"; + +pub const PROCMOUNTSTATS: &'static str = "/proc/self/mountstats"; + +const ROOTBUSPATH: &'static str = "/devices/pci0000:00"; + +const CGROUPPATH: &'static str = "/sys/fs/cgroup"; +const PROCCGROUPS: &'static str = "/proc/cgroups"; + +pub const TIMEOUT_HOTPLUG: u64 = 3; + +#[cfg_attr(rustfmt, rustfmt_skip)] +lazy_static! { + pub static ref FLAGS: HashMap<&'static str, (bool, MsFlags)> = { + let mut m = HashMap::new(); + m.insert("defaults", (false, MsFlags::empty())); + m.insert("ro", (false, MsFlags::MS_RDONLY)); + m.insert("rw", (true, MsFlags::MS_RDONLY)); + m.insert("suid", (true, MsFlags::MS_NOSUID)); + m.insert("nosuid", (false, MsFlags::MS_NOSUID)); + m.insert("dev", (true, MsFlags::MS_NODEV)); + m.insert("nodev", (false, MsFlags::MS_NODEV)); + m.insert("exec", (true, MsFlags::MS_NOEXEC)); + m.insert("noexec", (false, MsFlags::MS_NOEXEC)); + m.insert("sync", (false, MsFlags::MS_SYNCHRONOUS)); + m.insert("async", (true, MsFlags::MS_SYNCHRONOUS)); + m.insert("dirsync", (false, MsFlags::MS_DIRSYNC)); + m.insert("remount", (false, MsFlags::MS_REMOUNT)); + m.insert("mand", (false, MsFlags::MS_MANDLOCK)); + m.insert("nomand", (true, MsFlags::MS_MANDLOCK)); + m.insert("atime", (true, MsFlags::MS_NOATIME)); + m.insert("noatime", (false, MsFlags::MS_NOATIME)); + m.insert("diratime", (true, MsFlags::MS_NODIRATIME)); + m.insert("nodiratime", (false, MsFlags::MS_NODIRATIME)); + m.insert("bind", (false, MsFlags::MS_BIND)); + m.insert("rbind", (false, MsFlags::MS_BIND | MsFlags::MS_REC)); + m.insert("unbindable", (false, MsFlags::MS_UNBINDABLE)); + m.insert("runbindable", (false, MsFlags::MS_UNBINDABLE | MsFlags::MS_REC)); + m.insert("private", (false, MsFlags::MS_PRIVATE)); + m.insert("rprivate", (false, MsFlags::MS_PRIVATE | MsFlags::MS_REC)); + m.insert("shared", (false, MsFlags::MS_SHARED)); + m.insert("rshared", (false, MsFlags::MS_SHARED | MsFlags::MS_REC)); + m.insert("slave", (false, MsFlags::MS_SLAVE)); + m.insert("rslave", (false, MsFlags::MS_SLAVE | MsFlags::MS_REC)); + m.insert("relatime", (false, MsFlags::MS_RELATIME)); + m.insert("norelatime", (true, MsFlags::MS_RELATIME)); + m.insert("strictatime", (false, MsFlags::MS_STRICTATIME)); + m.insert("nostrictatime", (true, MsFlags::MS_STRICTATIME)); + m + }; +} + +#[derive(Debug, PartialEq)] +pub struct INIT_MOUNT { + fstype: &'static str, + src: &'static str, + dest: &'static str, + options: Vec<&'static str>, +} + +#[cfg_attr(rustfmt, rustfmt_skip)] +lazy_static!{ + static ref CGROUPS: HashMap<&'static str, &'static str> = { + let mut m = HashMap::new(); + m.insert("cpu", "/sys/fs/cgroup/cpu"); + m.insert("cpuacct", "/sys/fs/cgroup/cpuacct"); + m.insert("blkio", "/sys/fs/cgroup/blkio"); + m.insert("cpuset", "/sys/fs/cgroup/cpuset"); + m.insert("memory", "/sys/fs/cgroup/memory"); + m.insert("devices", "/sys/fs/cgroup/devices"); + m.insert("freezer", "/sys/fs/cgroup/freezer"); + m.insert("net_cls", "/sys/fs/cgroup/net_cls"); + m.insert("perf_event", "/sys/fs/cgroup/perf_event"); + m.insert("net_prio", "/sys/fs/cgroup/net_prio"); + m.insert("hugetlb", "/sys/fs/cgroup/hugetlb"); + m.insert("pids", "/sys/fs/cgroup/pids"); + m.insert("rdma", "/sys/fs/cgroup/rdma"); + m + }; +} + +#[cfg_attr(rustfmt, rustfmt_skip)] +lazy_static! { + pub static ref INIT_ROOTFS_MOUNTS: Vec = vec![ + INIT_MOUNT{fstype: "proc", src: "proc", dest: "/proc", options: vec!["nosuid", "nodev", "noexec"]}, + INIT_MOUNT{fstype: "sysfs", src: "sysfs", dest: "/sys", options: vec!["nosuid", "nodev", "noexec"]}, + INIT_MOUNT{fstype: "devtmpfs", src: "dev", dest: "/dev", options: vec!["nosuid"]}, + INIT_MOUNT{fstype: "tmpfs", src: "tmpfs", dest: "/dev/shm", options: vec!["nosuid", "nodev"]}, + INIT_MOUNT{fstype: "devpts", src: "devpts", dest: "/dev/pts", options: vec!["nosuid", "noexec"]}, + INIT_MOUNT{fstype: "tmpfs", src: "tmpfs", dest: "/run", options: vec!["nosuid", "nodev"]}, + ]; +} + +// StorageHandler is the type of callback to be defined to handle every +// type of storage driver. +type StorageHandler = fn(&Logger, &Storage, Arc>) -> Result; + +// StorageHandlerList lists the supported drivers. +#[cfg_attr(rustfmt, rustfmt_skip)] +lazy_static! { + pub static ref STORAGEHANDLERLIST: HashMap<&'static str, StorageHandler> = { + let mut m = HashMap::new(); + let blk: StorageHandler = virtio_blk_storage_handler; + m.insert(DRIVERBLKTYPE, blk); + let p9: StorageHandler= virtio9p_storage_handler; + m.insert(DRIVER9PTYPE, p9); + let virtiofs: StorageHandler = virtiofs_storage_handler; + m.insert(DRIVERVIRTIOFSTYPE, virtiofs); + let ephemeral: StorageHandler = ephemeral_storage_handler; + m.insert(DRIVEREPHEMERALTYPE, ephemeral); + let virtiommio: StorageHandler = virtiommio_blk_storage_handler; + m.insert(DRIVERMMIOBLKTYPE, virtiommio); + let local: StorageHandler = local_storage_handler; + m.insert(DRIVERLOCALTYPE, local); + let scsi: StorageHandler = virtio_scsi_storage_handler; + m.insert(DRIVERSCSITYPE, scsi); + m + }; +} + +#[derive(Debug, Clone)] +pub struct BareMount<'a> { + source: &'a str, + destination: &'a str, + fs_type: &'a str, + flags: MsFlags, + options: &'a str, + logger: Logger, +} + +// mount mounts a source in to a destination. This will do some bookkeeping: +// * evaluate all symlinks +// * ensure the source exists +impl<'a> BareMount<'a> { + pub fn new( + s: &'a str, + d: &'a str, + fs_type: &'a str, + flags: MsFlags, + options: &'a str, + logger: &Logger, + ) -> Self { + BareMount { + source: s, + destination: d, + fs_type: fs_type, + flags: flags, + options: options, + logger: logger.new(o!("subsystem" => "baremount")), + } + } + + pub fn mount(&self) -> Result<()> { + let source; + let dest; + let fs_type; + let mut options = null(); + let cstr_options: CString; + let cstr_source: CString; + let cstr_dest: CString; + let cstr_fs_type: CString; + + if self.source.len() == 0 { + return Err(ErrorKind::ErrorCode("need mount source".to_string()).into()); + } + + if self.destination.len() == 0 { + return Err(ErrorKind::ErrorCode("need mount destination".to_string()).into()); + } + + cstr_source = CString::new(self.source)?; + source = cstr_source.as_ptr(); + + cstr_dest = CString::new(self.destination)?; + dest = cstr_dest.as_ptr(); + + if self.fs_type.len() == 0 { + return Err(ErrorKind::ErrorCode("need mount FS type".to_string()).into()); + } + + cstr_fs_type = CString::new(self.fs_type)?; + fs_type = cstr_fs_type.as_ptr(); + + if self.options.len() > 0 { + cstr_options = CString::new(self.options)?; + options = cstr_options.as_ptr() as *const c_void; + } + + info!( + self.logger, + "mount source={:?}, dest={:?}, fs_type={:?}, options={:?}", + self.source, + self.destination, + self.fs_type, + self.options + ); + let rc = unsafe { mount(source, dest, fs_type, self.flags.bits(), options) }; + + if rc < 0 { + return Err(ErrorKind::ErrorCode(format!( + "failed to mount {:?} to {:?}, with error: {}", + self.source, + self.destination, + io::Error::last_os_error() + )) + .into()); + } + Ok(()) + } +} + +fn ephemeral_storage_handler( + logger: &Logger, + storage: &Storage, + sandbox: Arc>, +) -> Result { + let s = sandbox.clone(); + let mut sb = s.lock().unwrap(); + let new_storage = sb.set_sandbox_storage(&storage.mount_point); + + if !new_storage { + return Ok("".to_string()); + } + + if let Err(err) = fs::create_dir_all(Path::new(&storage.mount_point)) { + return Err(err.into()); + } + + common_storage_handler(logger, storage) +} + +fn local_storage_handler( + _logger: &Logger, + storage: &Storage, + sandbox: Arc>, +) -> Result { + let s = sandbox.clone(); + let mut sb = s.lock().unwrap(); + let new_storage = sb.set_sandbox_storage(&storage.mount_point); + + if !new_storage { + return Ok("".to_string()); + } + + fs::create_dir_all(&storage.mount_point)?; + + let opts_vec: Vec = storage.options.to_vec(); + + let opts = parse_options(opts_vec); + let mode = opts.get("mode"); + if mode.is_some() { + let mode = mode.unwrap(); + let mut permission = fs::metadata(&storage.mount_point)?.permissions(); + + let o_mode = u32::from_str_radix(mode, 8)?; + permission.set_mode(o_mode); + + fs::set_permissions(&storage.mount_point, permission)?; + } + + Ok("".to_string()) +} + +fn virtio9p_storage_handler( + logger: &Logger, + storage: &Storage, + _sandbox: Arc>, +) -> Result { + common_storage_handler(logger, storage) +} + +// virtiommio_blk_storage_handler handles the storage for mmio blk driver. +fn virtiommio_blk_storage_handler( + logger: &Logger, + storage: &Storage, + _sandbox: Arc>, +) -> Result { + //The source path is VmPath + common_storage_handler(logger, storage) +} + +// virtiofs_storage_handler handles the storage for virtio-fs. +fn virtiofs_storage_handler( + logger: &Logger, + storage: &Storage, + _sandbox: Arc>, +) -> Result { + common_storage_handler(logger, storage) +} + +// virtio_blk_storage_handler handles the storage for blk driver. +fn virtio_blk_storage_handler( + logger: &Logger, + storage: &Storage, + sandbox: Arc>, +) -> Result { + let mut storage = storage.clone(); + // If hot-plugged, get the device node path based on the PCI address else + // use the virt path provided in Storage Source + if storage.source.starts_with("/dev") { + let metadata = fs::metadata(&storage.source)?; + + let mode = metadata.permissions().mode(); + if mode & libc::S_IFBLK == 0 { + return Err(ErrorKind::ErrorCode(format!("Invalid device {}", &storage.source)).into()); + } + } else { + let dev_path = get_pci_device_name(sandbox, &storage.source)?; + storage.source = dev_path; + } + + common_storage_handler(logger, &storage) +} + +// virtio_scsi_storage_handler handles the storage for scsi driver. +fn virtio_scsi_storage_handler( + logger: &Logger, + storage: &Storage, + sandbox: Arc>, +) -> Result { + let mut storage = storage.clone(); + + // Retrieve the device path from SCSI address. + let dev_path = get_scsi_device_name(sandbox, &storage.source)?; + storage.source = dev_path; + + common_storage_handler(logger, &storage) +} + +fn common_storage_handler(logger: &Logger, storage: &Storage) -> Result { + // Mount the storage device. + let mount_point = storage.mount_point.to_string(); + + mount_storage(logger, storage).and(Ok(mount_point)) +} + +// mount_storage performs the mount described by the storage structure. +fn mount_storage(logger: &Logger, storage: &Storage) -> Result<()> { + let logger = logger.new(o!("subsystem" => "mount")); + + match storage.fstype.as_str() { + DRIVER9PTYPE | DRIVERVIRTIOFSTYPE => { + let dest_path = Path::new(storage.mount_point.as_str()); + if !dest_path.exists() { + fs::create_dir_all(dest_path).chain_err(|| "Create mount destination failed")?; + } + } + _ => { + ensure_destination_exists(storage.mount_point.as_str(), storage.fstype.as_str())?; + } + } + + let options_vec = storage.options.to_vec(); + let options_vec = Vec::from_iter(options_vec.iter().map(String::as_str)); + let (flags, options) = parse_mount_flags_and_options(options_vec); + + info!(logger, "mounting storage"; + "mount-source:" => storage.source.as_str(), + "mount-destination" => storage.mount_point.as_str(), + "mount-fstype" => storage.fstype.as_str(), + "mount-options" => options.as_str(), + ); + + let bare_mount = BareMount::new( + storage.source.as_str(), + storage.mount_point.as_str(), + storage.fstype.as_str(), + flags, + options.as_str(), + &logger, + ); + + bare_mount.mount() +} + +fn parse_mount_flags_and_options(options_vec: Vec<&str>) -> (MsFlags, String) { + let mut flags = MsFlags::empty(); + let mut options: String = "".to_string(); + + for opt in options_vec { + if opt.len() != 0 { + match FLAGS.get(opt) { + Some(x) => { + let (_, f) = *x; + flags = flags | f; + } + None => { + if options.len() > 0 { + options.push_str(format!(",{}", opt).as_str()); + } else { + options.push_str(format!("{}", opt).as_str()); + } + } + }; + } + } + (flags, options) +} + +// add_storages takes a list of storages passed by the caller, and perform the +// associated operations such as waiting for the device to show up, and mount +// it to a specific location, according to the type of handler chosen, and for +// each storage. +pub fn add_storages( + logger: Logger, + storages: Vec, + sandbox: Arc>, +) -> Result> { + let mut mount_list = Vec::new(); + + for storage in storages { + let handler_name = storage.driver.clone(); + let logger = logger.new(o!( + "subsystem" => "storage", + "storage-type" => handler_name.to_owned())); + + let handler = match STORAGEHANDLERLIST.get(&handler_name.as_str()) { + None => { + return Err(ErrorKind::ErrorCode(format!( + "Failed to find the storage handler {}", + storage.driver.to_owned() + )) + .into()); + } + Some(f) => f, + }; + + let mount_point = match handler(&logger, &storage, sandbox.clone()) { + // Todo need to rollback the mounted storage if err met. + Err(e) => return Err(e), + Ok(m) => m, + }; + + if mount_point.len() > 0 { + mount_list.push(mount_point); + } + } + + Ok(mount_list) +} + +fn mount_to_rootfs(logger: &Logger, m: &INIT_MOUNT) -> Result<()> { + let options_vec: Vec<&str> = m.options.clone(); + + let (flags, options) = parse_mount_flags_and_options(options_vec); + + let bare_mount = BareMount::new(m.src, m.dest, m.fstype, flags, options.as_str(), logger); + + fs::create_dir_all(Path::new(m.dest)).chain_err(|| "could not create directory")?; + + if let Err(err) = bare_mount.mount() { + if m.src != "dev" { + return Err(err.into()); + } + error!( + logger, + "Could not mount filesystem from {} to {}", m.src, m.dest + ); + } + + Ok(()) +} + +pub fn general_mount(logger: &Logger) -> Result<()> { + let logger = logger.new(o!("subsystem" => "mount")); + + for m in INIT_ROOTFS_MOUNTS.iter() { + mount_to_rootfs(&logger, m)?; + } + + Ok(()) +} + +#[inline] +pub fn get_mount_fs_type(mount_point: &str) -> Result { + get_mount_fs_type_from_file(PROCMOUNTSTATS, mount_point) +} + +// get_mount_fs_type returns the FS type corresponding to the passed mount point and +// any error ecountered. +pub fn get_mount_fs_type_from_file(mount_file: &str, mount_point: &str) -> Result { + if mount_point == "" { + return Err(ErrorKind::ErrorCode(format!("Invalid mount point {}", mount_point)).into()); + } + + let file = File::open(mount_file)?; + let reader = BufReader::new(file); + + let re = Regex::new(format!("device .+ mounted on {} with fstype (.+)", mount_point).as_str()) + .unwrap(); + + // Read the file line by line using the lines() iterator from std::io::BufRead. + for (_index, line) in reader.lines().enumerate() { + let line = line?; + let capes = match re.captures(line.as_str()) { + Some(c) => c, + None => continue, + }; + + if capes.len() > 1 { + return Ok(capes[1].to_string()); + } + } + + Err(ErrorKind::ErrorCode(format!( + "failed to find FS type for mount point {}", + mount_point + )) + .into()) +} + +pub fn get_cgroup_mounts(logger: &Logger, cg_path: &str) -> Result> { + let file = File::open(&cg_path)?; + let reader = BufReader::new(file); + + let mut has_device_cgroup = false; + let mut cg_mounts: Vec = vec![INIT_MOUNT { + fstype: "tmpfs", + src: "tmpfs", + dest: CGROUPPATH, + options: vec!["nosuid", "nodev", "noexec", "mode=755"], + }]; + + // #subsys_name hierarchy num_cgroups enabled + // fields[0] fields[1] fields[2] fields[3] + 'outer: for (_, line) in reader.lines().enumerate() { + let line = line?; + + let fields: Vec<&str> = line.split("\t").collect(); + + // Ignore comment header + if fields[0].starts_with("#") { + continue; + } + + // Ignore truncated lines + if fields.len() < 4 { + continue; + } + + // Ignore disabled cgroups + if fields[3] == "0" { + continue; + } + + // Ignore fields containing invalid numerics + for f in [fields[1], fields[2], fields[3]].iter() { + if f.parse::().is_err() { + continue 'outer; + } + } + + match CGROUPS.get_key_value(fields[0]) { + Some((key, value)) => { + if *key == "" { + continue; + } + + if *key == "devices" { + has_device_cgroup = true; + } + + cg_mounts.push(INIT_MOUNT { + fstype: "cgroup", + src: "cgroup", + dest: *value, + options: vec!["nosuid", "nodev", "noexec", "relatime", *key], + }); + } + None => continue, + } + } + + if !has_device_cgroup { + warn!(logger, "The system didn't support device cgroup, which is dangerous, thus agent initialized without cgroup support!\n"); + return Ok(Vec::new()); + } + + cg_mounts.push(INIT_MOUNT { + fstype: "tmpfs", + src: "tmpfs", + dest: CGROUPPATH, + options: vec!["remount", "ro", "nosuid", "nodev", "noexec", "mode=755"], + }); + + Ok(cg_mounts) +} + +pub fn cgroups_mount(logger: &Logger) -> Result<()> { + let logger = logger.new(o!("subsystem" => "mount")); + + let cgroups = get_cgroup_mounts(&logger, PROCCGROUPS)?; + + for cg in cgroups.iter() { + mount_to_rootfs(&logger, cg)?; + } + + // Enable memory hierarchical account. + // For more information see https://www.kernel.org/doc/Documentation/cgroup-v1/memory.txt + online_device("/sys/fs/cgroup/memory//memory.use_hierarchy")?; + Ok(()) +} + +pub fn remove_mounts(mounts: &Vec) -> Result<()> { + for m in mounts.iter() { + mount::umount(m.as_str())?; + } + Ok(()) +} + +// ensureDestinationExists will recursively create a given mountpoint. If directories +// are created, their permissions are initialized to mountPerm +fn ensure_destination_exists(destination: &str, fs_type: &str) -> Result<()> { + let d = Path::new(destination); + if !d.exists() { + let dir = match d.parent() { + Some(d) => d, + None => { + return Err(ErrorKind::ErrorCode(format!( + "mount destination {} doesn't exist", + destination + )) + .into()) + } + }; + if !dir.exists() { + fs::create_dir_all(dir)?; + } + } + + if fs_type != "bind" || d.is_dir() { + fs::create_dir_all(d)?; + } else { + fs::OpenOptions::new().create(true).open(d)?; + } + + Ok(()) +} + +fn parse_options(option_list: Vec) -> HashMap { + let mut options = HashMap::new(); + for opt in option_list.iter() { + let fields: Vec<&str> = opt.split("=").collect(); + if fields.len() != 2 { + continue; + } + + options.insert(fields[0].to_string(), fields[1].to_string()); + } + + options +} + +#[cfg(test)] + +mod tests { + use super::*; + use libc::umount; + use std::fs::File; + use std::fs::OpenOptions; + use std::io::Write; + use std::path::PathBuf; + use tempfile::tempdir; + + #[allow(unused_macros)] + macro_rules! skip_if_root { + () => { + if nix::unistd::Uid::effective().is_root() { + println!("INFO: skipping {} which needs non-root", module_path!()); + return; + } + }; + } + + #[allow(unused_macros)] + macro_rules! skip_if_not_root { + () => { + if !nix::unistd::Uid::effective().is_root() { + println!("INFO: skipping {} which needs root", module_path!()); + return; + } + }; + } + + #[allow(unused_macros)] + macro_rules! skip_loop_if_root { + ($msg:expr) => { + if nix::unistd::Uid::effective().is_root() { + println!( + "INFO: skipping loop {} in {} which needs non-root", + $msg, + module_path!() + ); + continue; + } + }; + } + + #[allow(unused_macros)] + macro_rules! skip_loop_if_not_root { + ($msg:expr) => { + if !nix::unistd::Uid::effective().is_root() { + println!( + "INFO: skipping loop {} in {} which needs root", + $msg, + module_path!() + ); + continue; + } + }; + } + + #[derive(Debug, PartialEq)] + enum TestUserType { + RootOnly, + NonRootOnly, + Any, + } + + #[test] + fn test_mount() { + #[derive(Debug)] + struct TestData<'a> { + // User(s) who can run this test + test_user: TestUserType, + + src: &'a str, + dest: &'a str, + fs_type: &'a str, + flags: MsFlags, + options: &'a str, + + // If set, assume an error will be generated, + // else assume no error. + // + // If not set, assume root required to perform a + // successful mount. + error_contains: &'a str, + } + + let dir = tempdir().expect("failed to create tmpdir"); + let drain = slog::Discard; + let logger = slog::Logger::root(drain, o!()); + + let tests = &[ + TestData { + test_user: TestUserType::Any, + src: "", + dest: "", + fs_type: "", + flags: MsFlags::empty(), + options: "", + error_contains: "need mount source", + }, + TestData { + test_user: TestUserType::Any, + src: "from", + dest: "", + fs_type: "", + flags: MsFlags::empty(), + options: "", + error_contains: "need mount destination", + }, + TestData { + test_user: TestUserType::Any, + src: "from", + dest: "to", + fs_type: "", + flags: MsFlags::empty(), + options: "", + error_contains: "need mount FS type", + }, + TestData { + test_user: TestUserType::NonRootOnly, + src: "from", + dest: "to", + fs_type: "bind", + flags: MsFlags::empty(), + options: "bind", + error_contains: "Operation not permitted", + }, + TestData { + test_user: TestUserType::NonRootOnly, + src: "from", + dest: "to", + fs_type: "bind", + flags: MsFlags::MS_BIND, + options: "", + error_contains: "Operation not permitted", + }, + TestData { + test_user: TestUserType::RootOnly, + src: "from", + dest: "to", + fs_type: "bind", + flags: MsFlags::MS_BIND, + options: "", + error_contains: "", + }, + ]; + + for (i, d) in tests.iter().enumerate() { + let msg = format!("test[{}]: {:?}", i, d); + + if d.test_user == TestUserType::RootOnly { + skip_loop_if_not_root!(msg); + } else if d.test_user == TestUserType::NonRootOnly { + skip_loop_if_root!(msg); + } + + let src: PathBuf; + let dest: PathBuf; + + let src_filename: String; + let dest_filename: String; + + if d.src != "" { + src = dir.path().join(d.src.to_string()); + src_filename = src + .to_str() + .expect("failed to convert src to filename") + .to_string(); + } else { + src_filename = "".to_owned(); + } + + if d.dest != "" { + dest = dir.path().join(d.dest.to_string()); + dest_filename = dest + .to_str() + .expect("failed to convert dest to filename") + .to_string(); + } else { + dest_filename = "".to_owned(); + } + + // Create the mount directories + for d in [src_filename.clone(), dest_filename.clone()].iter() { + if d == "" { + continue; + } + + std::fs::create_dir_all(d).expect("failed to created directory"); + } + + let bare_mount = BareMount::new( + &src_filename, + &dest_filename, + d.fs_type, + d.flags, + d.options, + &logger, + ); + + let result = bare_mount.mount(); + + let msg = format!("{}: result: {:?}", msg, result); + + if d.error_contains == "" { + assert!(result.is_ok(), msg); + + // Cleanup + unsafe { + let cstr_dest = + CString::new(dest_filename).expect("failed to convert dest to cstring"); + let umount_dest = cstr_dest.as_ptr(); + + let ret = umount(umount_dest); + + let msg = format!("{}: umount result: {:?}", msg, result); + + assert!(ret == 0, format!("{}", msg)); + }; + + continue; + } + + let err = result.unwrap_err(); + let error_msg = format!("{}", err); + assert!(error_msg.contains(d.error_contains), msg); + } + } + + #[test] + fn test_remove_mounts() { + skip_if_not_root!(); + + #[derive(Debug)] + struct TestData<'a> { + mounts: Vec, + + // If set, assume an error will be generated, + // else assume no error. + error_contains: &'a str, + } + + let dir = tempdir().expect("failed to create tmpdir"); + let drain = slog::Discard; + let logger = slog::Logger::root(drain, o!()); + + let test_dir_path = dir.path().join("dir"); + let test_dir_filename = test_dir_path + .to_str() + .expect("failed to create mount dir filename"); + + let test_file_path = dir.path().join("file"); + let test_file_filename = test_file_path + .to_str() + .expect("failed to create mount file filename"); + + OpenOptions::new() + .create(true) + .write(true) + .open(test_file_filename) + .expect("failed to create test file"); + + std::fs::create_dir_all(test_dir_filename).expect("failed to create dir"); + + let mnt_src = dir.path().join("mnt-src"); + let mnt_src_filename = mnt_src + .to_str() + .expect("failed to create mount source filename"); + + let mnt_dest = dir.path().join("mnt-dest"); + let mnt_dest_filename = mnt_dest + .to_str() + .expect("failed to create mount destination filename"); + + for d in [test_dir_filename, mnt_src_filename, mnt_dest_filename].iter() { + std::fs::create_dir_all(d).expect(&format!("failed to create directory {}", d)); + } + + // Create an actual mount + let bare_mount = BareMount::new( + &mnt_src_filename, + &mnt_dest_filename, + "bind", + MsFlags::MS_BIND, + "", + &logger, + ); + + let result = bare_mount.mount(); + assert!(result.is_ok(), "mount for test setup failed"); + + let tests = &[ + TestData { + mounts: vec![], + error_contains: "", + }, + TestData { + mounts: vec!["".to_string()], + error_contains: "ENOENT: No such file or directory", + }, + TestData { + mounts: vec![test_file_filename.to_string()], + error_contains: "EINVAL: Invalid argument", + }, + TestData { + mounts: vec![test_dir_filename.to_string()], + error_contains: "EINVAL: Invalid argument", + }, + TestData { + mounts: vec![mnt_dest_filename.to_string()], + error_contains: "", + }, + ]; + + for (i, d) in tests.iter().enumerate() { + let msg = format!("test[{}]: {:?}", i, d); + + let result = remove_mounts(&d.mounts); + + let msg = format!("{}: result: {:?}", msg, result); + + if d.error_contains == "" { + assert!(result.is_ok(), msg); + continue; + } + + let error_msg = format!("{}", result.unwrap_err()); + + assert!(error_msg.contains(d.error_contains), msg); + } + } + + #[test] + fn test_get_mount_fs_type_from_file() { + #[derive(Debug)] + struct TestData<'a> { + // Create file with the specified contents + // (even if a nul string is specified). + contents: &'a str, + mount_point: &'a str, + + // If set, assume an error will be generated, + // else assume no error. + error_contains: &'a str, + + // successful return value + fs_type: &'a str, + } + + let dir = tempdir().expect("failed to create tmpdir"); + + let tests = &[ + TestData { + contents: "", + mount_point: "", + error_contains: "Invalid mount point", + fs_type: "", + }, + TestData { + contents: "foo", + mount_point: "", + error_contains: "Invalid mount point", + fs_type: "", + }, + TestData { + contents: "foo", + mount_point: "/", + error_contains: "failed to find FS type for mount point /", + fs_type: "", + }, + TestData { + // contents missing fields + contents: "device /dev/mapper/root mounted on /", + mount_point: "/", + error_contains: "failed to find FS type for mount point /", + fs_type: "", + }, + TestData { + contents: "device /dev/mapper/root mounted on / with fstype ext4", + mount_point: "/", + error_contains: "", + fs_type: "ext4", + }, + ]; + + let enoent_file_path = dir.path().join("enoent"); + let enoent_filename = enoent_file_path + .to_str() + .expect("failed to create enoent filename"); + + // First, test that an empty mount file is handled + for (i, mp) in ["/", "/somewhere", "/tmp", enoent_filename] + .iter() + .enumerate() + { + let msg = format!("missing mount file test[{}] with mountpoint: {}", i, mp); + + let result = get_mount_fs_type_from_file("", mp); + let err = result.unwrap_err(); + + let msg = format!("{}: error: {}", msg, err); + + assert!( + format!("{}", err).contains("No such file or directory"), + msg + ); + } + + // Now, test various combinations of file contents + for (i, d) in tests.iter().enumerate() { + let msg = format!("test[{}]: {:?}", i, d); + + let file_path = dir.path().join("mount_stats"); + + let filename = file_path + .to_str() + .expect(&format!("{}: failed to create filename", msg)); + + let mut file = + File::create(filename).expect(&format!("{}: failed to create file", msg)); + + file.write_all(d.contents.as_bytes()) + .expect(&format!("{}: failed to write file contents", msg)); + + let result = get_mount_fs_type_from_file(filename, d.mount_point); + + // add more details if an assertion fails + let msg = format!("{}: result: {:?}", msg, result); + + if d.error_contains == "" { + let fs_type = result.unwrap(); + + assert!(d.fs_type == fs_type, msg); + + continue; + } + + let error_msg = format!("{}", result.unwrap_err()); + assert!(error_msg.contains(d.error_contains), msg); + } + } + + #[test] + fn test_get_cgroup_mounts() { + #[derive(Debug)] + struct TestData<'a> { + // Create file with the specified contents + // (even if a nul string is specified). + contents: &'a str, + + // If set, assume an error will be generated, + // else assume no error. + error_contains: &'a str, + + // Set if the devices cgroup is expected to be found + devices_cgroup: bool, + } + + let dir = tempdir().expect("failed to create tmpdir"); + let drain = slog::Discard; + let logger = slog::Logger::root(drain, o!()); + + let first_mount = INIT_MOUNT { + fstype: "tmpfs", + src: "tmpfs", + dest: CGROUPPATH, + options: vec!["nosuid", "nodev", "noexec", "mode=755"], + }; + + let last_mount = INIT_MOUNT { + fstype: "tmpfs", + src: "tmpfs", + dest: CGROUPPATH, + options: vec!["remount", "ro", "nosuid", "nodev", "noexec", "mode=755"], + }; + + let cg_devices_mount = INIT_MOUNT { + fstype: "cgroup", + src: "cgroup", + dest: "/sys/fs/cgroup/devices", + options: vec!["nosuid", "nodev", "noexec", "relatime", "devices"], + }; + + let enoent_file_path = dir.path().join("enoent"); + let enoent_filename = enoent_file_path + .to_str() + .expect("failed to create enoent filename"); + + let tests = &[ + TestData { + // Empty file + contents: "", + error_contains: "", + devices_cgroup: false, + }, + TestData { + // Only a comment line + contents: "#subsys_name hierarchy num_cgroups enabled", + error_contains: "", + devices_cgroup: false, + }, + TestData { + // Single (invalid) field + contents: "foo", + error_contains: "", + devices_cgroup: false, + }, + TestData { + // Multiple (invalid) fields + contents: "this\tis\tinvalid\tdata\n", + error_contains: "", + devices_cgroup: false, + }, + TestData { + // Valid first field, but other fields missing + contents: "devices\n", + error_contains: "", + devices_cgroup: false, + }, + TestData { + // Valid first field, but invalid others fields + contents: "devices\tinvalid\tinvalid\tinvalid\n", + error_contains: "", + devices_cgroup: false, + }, + TestData { + // Valid first field, but lots of invalid others fields + contents: "devices\tinvalid\tinvalid\tinvalid\tinvalid\tinvalid\n", + error_contains: "", + devices_cgroup: false, + }, + TestData { + // Valid, but disabled + contents: "devices\t1\t1\t0\n", + error_contains: "", + devices_cgroup: false, + }, + TestData { + // Valid + contents: "devices\t1\t1\t1\n", + error_contains: "", + devices_cgroup: true, + }, + ]; + + // First, test a missing file + let result = get_cgroup_mounts(&logger, enoent_filename); + + assert!(result.is_err()); + let error_msg = format!("{}", result.unwrap_err()); + assert!( + error_msg.contains("No such file or directory"), + "enoent test" + ); + + for (i, d) in tests.iter().enumerate() { + let msg = format!("test[{}]: {:?}", i, d); + + let file_path = dir.path().join("cgroups"); + let filename = file_path + .to_str() + .expect("failed to create cgroup file filename"); + + let mut file = + File::create(filename).expect(&format!("{}: failed to create file", msg)); + + file.write_all(d.contents.as_bytes()) + .expect(&format!("{}: failed to write file contents", msg)); + + let result = get_cgroup_mounts(&logger, filename); + let msg = format!("{}: result: {:?}", msg, result); + + if d.error_contains != "" { + assert!(result.is_err(), msg); + + let error_msg = format!("{}", result.unwrap_err()); + assert!(error_msg.contains(d.error_contains), msg); + continue; + } + + assert!(result.is_ok(), msg); + + let mounts = result.unwrap(); + let count = mounts.len(); + + if !d.devices_cgroup { + assert!(count == 0, msg); + continue; + } + + // get_cgroup_mounts() adds the device cgroup plus two other mounts. + assert!(count == (1 + 2), msg); + + // First mount + assert!(mounts[0].eq(&first_mount), msg); + + // Last mount + assert!(mounts[2].eq(&last_mount), msg); + + // Devices cgroup + assert!(mounts[1].eq(&cg_devices_mount), msg); + } + } +} diff --git a/src/agent/src/namespace.rs b/src/agent/src/namespace.rs new file mode 100644 index 0000000000..f08b59933e --- /dev/null +++ b/src/agent/src/namespace.rs @@ -0,0 +1,119 @@ +// Copyright (c) 2019 Ant Financial +// +// SPDX-License-Identifier: Apache-2.0 +// + +use nix::mount::MsFlags; +use nix::sched::{unshare, CloneFlags}; +use nix::unistd::{getpid, gettid}; +use std::collections::HashMap; +use std::fs; +use std::fs::File; +use std::os::unix::io::AsRawFd; +use std::path::Path; +use std::thread; + +use crate::mount::{BareMount, FLAGS}; +use slog::Logger; + +//use container::Process; + +const PERSISTENT_NS_DIR: &'static str = "/var/run/sandbox-ns"; +pub const NSTYPEIPC: &'static str = "ipc"; +pub const NSTYPEUTS: &'static str = "uts"; +pub const NSTYPEPID: &'static str = "pid"; + +lazy_static! { + static ref CLONE_FLAG_TABLE: HashMap<&'static str, CloneFlags> = { + let mut m = HashMap::new(); + m.insert(NSTYPEIPC, CloneFlags::CLONE_NEWIPC); + m.insert(NSTYPEUTS, CloneFlags::CLONE_NEWUTS); + m + }; +} + +#[derive(Debug, Default)] +pub struct Namespace { + pub path: String, +} + +pub fn get_current_thread_ns_path(ns_type: &str) -> String { + format!( + "/proc/{}/task/{}/ns/{}", + getpid().to_string(), + gettid().to_string(), + ns_type + ) +} + +// setup_persistent_ns creates persistent namespace without switchin to it. +// Note, pid namespaces cannot be persisted. +pub fn setup_persistent_ns(logger: Logger, ns_type: &'static str) -> Result { + if let Err(err) = fs::create_dir_all(PERSISTENT_NS_DIR) { + return Err(err.to_string()); + } + + let ns_path = Path::new(PERSISTENT_NS_DIR); + let new_ns_path = ns_path.join(ns_type); + + if let Err(err) = File::create(new_ns_path.as_path()) { + return Err(err.to_string()); + } + + let new_thread = thread::spawn(move || { + let origin_ns_path = get_current_thread_ns_path(ns_type); + let _origin_ns_fd = match File::open(Path::new(&origin_ns_path)) { + Err(err) => return Err(err.to_string()), + Ok(file) => file.as_raw_fd(), + }; + + // Create a new netns on the current thread. + let cf = match CLONE_FLAG_TABLE.get(ns_type) { + None => return Err(format!("Failed to get ns type {}", ns_type).to_string()), + Some(cf) => cf, + }; + + if let Err(err) = unshare(*cf) { + return Err(err.to_string()); + } + + // Bind mount the new namespace from the current thread onto the mount point to persist it. + let source: &str = origin_ns_path.as_str(); + let destination: &str = new_ns_path.as_path().to_str().unwrap_or("none"); + + let _recursive = true; + let _readonly = true; + let mut flags = MsFlags::empty(); + + match FLAGS.get("rbind") { + Some(x) => { + let (_, f) = *x; + flags = flags | f; + } + None => (), + }; + + let bare_mount = BareMount::new(source, destination, "none", flags, "", &logger); + + if let Err(err) = bare_mount.mount() { + return Err(format!( + "Failed to mount {} to {} with err:{:?}", + source, destination, err + )); + } + Ok(()) + }); + + match new_thread.join() { + Ok(t) => match t { + Err(err) => return Err(err), + Ok(()) => (), + }, + Err(err) => return Err(format!("Failed to join thread {:?}!", err)), + } + + let new_ns_path = ns_path.join(ns_type); + Ok(Namespace { + path: new_ns_path.into_os_string().into_string().unwrap(), + }) +} diff --git a/src/agent/src/netlink.rs b/src/agent/src/netlink.rs new file mode 100644 index 0000000000..101a20d6c0 --- /dev/null +++ b/src/agent/src/netlink.rs @@ -0,0 +1,2841 @@ +// Copyright (c) 2019 Ant Financial +// +// SPDX-License-Identifier: Apache-2.0 +// + +#![allow(non_camel_case_types)] +#![allow(non_upper_case_globals)] +#![allow(dead_code)] + +use libc; +use nix::errno::Errno; +use protobuf::RepeatedField; +use protocols::types::{IPAddress, IPFamily, Interface, Route}; +use rustjail::errors::*; +use std::clone::Clone; +use std::default::Default; +use std::fmt; +use std::mem; +use std::net::{Ipv4Addr, Ipv6Addr}; +use std::str::FromStr; + +// Convenience macro to obtain the scope logger +macro_rules! sl { + () => { + slog_scope::logger().new(o!("subsystem" => "netlink")) + }; +} + +// define the struct, const, etc needed by +// netlink operations + +pub type __s8 = libc::c_char; +pub type __u8 = libc::c_uchar; +pub type __s16 = libc::c_short; +pub type __u16 = libc::c_ushort; +pub type __s32 = libc::c_int; +pub type __u32 = libc::c_uint; +pub type __s64 = libc::c_longlong; +pub type __u64 = libc::c_ulonglong; + +// we need ifaddrmsg, ifinfomasg, rtmsg +// we need some constant + +pub const RTM_BASE: libc::c_ushort = 16; +pub const RTM_NEWLINK: libc::c_ushort = 16; +pub const RTM_DELLINK: libc::c_ushort = 17; +pub const RTM_GETLINK: libc::c_ushort = 18; +pub const RTM_SETLINK: libc::c_ushort = 19; +pub const RTM_NEWADDR: libc::c_ushort = 20; +pub const RTM_DELADDR: libc::c_ushort = 21; +pub const RTM_GETADDR: libc::c_ushort = 22; +pub const RTM_NEWROUTE: libc::c_ushort = 24; +pub const RTM_DELROUTE: libc::c_ushort = 25; +pub const RTM_GETROUTE: libc::c_ushort = 26; +pub const RTM_NEWNEIGH: libc::c_ushort = 28; +pub const RTM_DELNEIGH: libc::c_ushort = 29; +pub const RTM_GETNEIGH: libc::c_ushort = 30; +pub const RTM_NEWRULE: libc::c_ushort = 32; +pub const RTM_DELRULE: libc::c_ushort = 33; +pub const RTM_GETRULE: libc::c_ushort = 34; +pub const RTM_NEWQDISC: libc::c_ushort = 36; +pub const RTM_DELQDISC: libc::c_ushort = 37; +pub const RTM_GETQDISC: libc::c_ushort = 38; +pub const RTM_NEWTCLASS: libc::c_ushort = 40; +pub const RTM_DELTCLASS: libc::c_ushort = 41; +pub const RTM_GETTCLASS: libc::c_ushort = 42; +pub const RTM_NEWTFILTER: libc::c_ushort = 44; +pub const RTM_DELTFILTER: libc::c_ushort = 45; +pub const RTM_GETTFILTER: libc::c_ushort = 46; +pub const RTM_NEWACTION: libc::c_ushort = 48; +pub const RTM_DELACTION: libc::c_ushort = 49; +pub const RTM_GETACTION: libc::c_ushort = 50; +pub const RTM_NEWPREFIX: libc::c_ushort = 52; +pub const RTM_GETMULTICAST: libc::c_ushort = 58; +pub const RTM_GETANYCAST: libc::c_ushort = 62; +pub const RTM_NEWNEIGHTBL: libc::c_ushort = 64; +pub const RTM_GETNEIGHTBL: libc::c_ushort = 66; +pub const RTM_SETNEIGHTBL: libc::c_ushort = 67; +pub const RTM_NEWNDUSEROPT: libc::c_ushort = 68; +pub const RTM_NEWADDRLABEL: libc::c_ushort = 72; +pub const RTM_DELADDRLABEL: libc::c_ushort = 73; +pub const RTM_GETADDRLABEL: libc::c_ushort = 74; +pub const RTM_GETDCB: libc::c_ushort = 78; +pub const RTM_SETDCB: libc::c_ushort = 79; +pub const RTM_NEWNETCONF: libc::c_ushort = 80; +pub const RTM_GETNETCONF: libc::c_ushort = 82; +pub const RTM_NEWMDB: libc::c_ushort = 84; +pub const RTM_DELMDB: libc::c_ushort = 85; +pub const RTM_GETMDB: libc::c_ushort = 86; +pub const RTM_NEWNSID: libc::c_ushort = 88; +pub const RTM_DELNSID: libc::c_ushort = 89; +pub const RTM_GETNSID: libc::c_ushort = 90; +pub const RTM_NEWSTATS: libc::c_ushort = 92; +pub const RTM_GETSTATS: libc::c_ushort = 94; +pub const RTM_NEWCACHEREPORT: libc::c_ushort = 96; +pub const RTM_NEWCHAIN: libc::c_ushort = 100; +pub const RTM_DELCHAIN: libc::c_ushort = 101; +pub const RTM_GETCHAIN: libc::c_ushort = 102; +pub const __RTM_MAX: libc::c_ushort = 103; + +pub const RTM_MAX: libc::c_ushort = (((__RTM_MAX + 3) & !3) - 1); +pub const RTM_NR_MSGTYPES: libc::c_ushort = (RTM_MAX + 1) - RTM_BASE; +pub const RTM_NR_FAMILIES: libc::c_ushort = RTM_NR_MSGTYPES >> 2; + +#[macro_export] +macro_rules! RTM_FAM { + ($cmd: expr) => { + ($cmd - RTM_BASE) >> 2 + }; +} + +#[repr(C)] +#[derive(Copy)] +pub struct rtattr { + rta_len: libc::c_ushort, + rta_type: libc::c_ushort, +} + +impl Clone for rtattr { + fn clone(&self) -> Self { + Self { ..*self } + } +} + +impl Default for rtattr { + fn default() -> Self { + Self { + ..unsafe { mem::zeroed::() } + } + } +} + +#[repr(C)] +#[derive(Copy)] +pub struct rtmsg { + rtm_family: libc::c_uchar, + rtm_dst_len: libc::c_uchar, + rtm_src_len: libc::c_uchar, + rtm_tos: libc::c_uchar, + rtm_table: libc::c_uchar, + rtm_protocol: libc::c_uchar, + rtm_scope: libc::c_uchar, + rtm_type: libc::c_uchar, + rtm_flags: libc::c_uint, +} + +impl Clone for rtmsg { + fn clone(&self) -> Self { + Self { ..*self } + } +} + +impl Default for rtmsg { + fn default() -> Self { + Self { + ..unsafe { mem::zeroed::() } + } + } +} + +// rtm_type c_uchar +pub const RTN_UNSPEC: libc::c_uchar = 0; +pub const RTN_UNICAST: libc::c_uchar = 1; +pub const RTN_LOCAL: libc::c_uchar = 2; +pub const RTN_BROADCAST: libc::c_uchar = 3; +pub const RTN_ANYCAST: libc::c_uchar = 4; +pub const RTN_MULTICAST: libc::c_uchar = 5; +pub const RTN_BLACKHOLE: libc::c_uchar = 6; +pub const RTN_UNREACHABLE: libc::c_uchar = 7; +pub const RTN_PROHIBIT: libc::c_uchar = 8; +pub const RTN_THROW: libc::c_uchar = 9; +pub const RTN_NAT: libc::c_uchar = 10; +pub const RTN_XRESOLVE: libc::c_uchar = 11; +pub const __RTN_MAX: libc::c_uchar = 12; +pub const RTN_MAX: libc::c_uchar = __RTN_MAX - 1; + +// rtm_protocol c_uchar +pub const RTPROTO_UNSPEC: libc::c_uchar = 0; +pub const RTPROTO_REDIRECT: libc::c_uchar = 1; +pub const RTPROTO_KERNEL: libc::c_uchar = 2; +pub const RTPROTO_BOOT: libc::c_uchar = 3; +pub const RTPROTO_STATIC: libc::c_uchar = 4; + +pub const RTPROTO_GATED: libc::c_uchar = 8; +pub const RTPROTO_RA: libc::c_uchar = 9; +pub const RTPROTO_MRT: libc::c_uchar = 10; +pub const RTPROTO_ZEBRA: libc::c_uchar = 11; +pub const RTPROTO_BIRD: libc::c_uchar = 12; +pub const RTPROTO_DNROUTED: libc::c_uchar = 13; +pub const RTPROTO_XORP: libc::c_uchar = 14; +pub const RTPROTO_NTK: libc::c_uchar = 15; +pub const RTPROTO_DHCP: libc::c_uchar = 16; +pub const RTPROTO_MROUTED: libc::c_uchar = 17; +pub const RTPROTO_BABEL: libc::c_uchar = 42; +pub const RTPROTO_BGP: libc::c_uchar = 186; +pub const RTPROTO_ISIS: libc::c_uchar = 187; +pub const RTPROTO_OSPF: libc::c_uchar = 188; +pub const RTPROTO_RIP: libc::c_uchar = 189; +pub const RTPROTO_EIGRP: libc::c_uchar = 192; + +//rtm_scope c_uchar +pub const RT_SCOPE_UNIVERSE: libc::c_uchar = 0; +pub const RT_SCOPE_SITE: libc::c_uchar = 200; +pub const RT_SCOPE_LINK: libc::c_uchar = 253; +pub const RT_SCOPE_HOST: libc::c_uchar = 254; +pub const RT_SCOPE_NOWHERE: libc::c_uchar = 255; + +// rtm_flags c_uint +pub const RTM_F_NOTIFY: libc::c_uint = 0x100; +pub const RTM_F_CLONED: libc::c_uint = 0x200; +pub const RTM_F_EQUALIZE: libc::c_uint = 0x400; +pub const RTM_F_PREFIX: libc::c_uint = 0x800; +pub const RTM_F_LOOKUP_TABLE: libc::c_uint = 0x1000; +pub const RTM_F_FIB_MATCH: libc::c_uint = 0x2000; + +// table identifier +pub const RT_TABLE_UNSPEC: libc::c_uint = 0; +pub const RT_TABLE_COMPAT: libc::c_uint = 252; +pub const RT_TABLE_DEFAULT: libc::c_uint = 253; +pub const RT_TABLE_MAIN: libc::c_uint = 254; +pub const RT_TABLE_LOCAL: libc::c_uint = 255; +pub const RT_TABLE_MAX: libc::c_uint = 0xffffffff; + +// rat_type c_ushort +pub const RTA_UNSPEC: libc::c_ushort = 0; +pub const RTA_DST: libc::c_ushort = 1; +pub const RTA_SRC: libc::c_ushort = 2; +pub const RTA_IIF: libc::c_ushort = 3; +pub const RTA_OIF: libc::c_ushort = 4; +pub const RTA_GATEWAY: libc::c_ushort = 5; +pub const RTA_PRIORITY: libc::c_ushort = 6; +pub const RTA_PREFSRC: libc::c_ushort = 7; +pub const RTA_METRICS: libc::c_ushort = 8; +pub const RTA_MULTIPATH: libc::c_ushort = 9; +pub const RTA_PROTOINFO: libc::c_ushort = 10; +pub const RTA_FLOW: libc::c_ushort = 11; +pub const RTA_CACHEINFO: libc::c_ushort = 12; +pub const RTA_SESSION: libc::c_ushort = 13; +pub const RTA_MP_ALGO: libc::c_ushort = 14; +pub const RTA_TABLE: libc::c_ushort = 15; +pub const RTA_MARK: libc::c_ushort = 16; +pub const RTA_MFC_STATS: libc::c_ushort = 17; +pub const RTA_VIA: libc::c_ushort = 18; +pub const RTA_NEWDST: libc::c_ushort = 19; +pub const RTA_PREF: libc::c_ushort = 20; +pub const RTA_ENCAP_TYPE: libc::c_ushort = 21; +pub const RTA_ENCAP: libc::c_ushort = 22; +pub const RTA_EXPIRES: libc::c_ushort = 23; +pub const RTA_PAD: libc::c_ushort = 24; +pub const RTA_UID: libc::c_ushort = 25; +pub const RTA_TTL_PROPAGATE: libc::c_ushort = 26; +pub const RTA_IP_PROTO: libc::c_ushort = 27; +pub const RTA_SPORT: libc::c_ushort = 28; +pub const RTA_DPORT: libc::c_ushort = 29; +pub const __RTA_MAX: libc::c_ushort = 30; +pub const RTA_MAX: libc::c_ushort = __RTA_MAX - 1; + +#[macro_export] +macro_rules! RTM_RTA { + ($rtm: expr) => { + unsafe { + let mut p = $rtm as *mut rtmsg as i64; + p += NLMSG_ALIGN!(mem::size_of::()) as i64; + p as *mut rtattr + } + }; +} + +#[macro_export] +macro_rules! RTM_PAYLOAD { + ($h: expr) => { + NLMSG_PAYLOAD!($h, mem::size_of::()) + }; +} + +// RTA_MULTIPATH +#[repr(C)] +#[derive(Copy)] +pub struct rtnexthop { + rtnh_len: libc::c_ushort, + rtnh_flags: libc::c_uchar, + rtnh_hops: libc::c_uchar, + rtnh_ifindex: libc::c_int, +} + +impl Clone for rtnexthop { + fn clone(&self) -> Self { + Self { ..*self } + } +} + +impl Default for rtnexthop { + fn default() -> Self { + Self { + ..unsafe { mem::zeroed::() } + } + } +} + +// rtnh_flags +pub const RTNH_F_DEAD: libc::c_uchar = 1; +pub const RTNH_F_PERVASIVE: libc::c_uchar = 2; +pub const RTNH_F_ONLINK: libc::c_uchar = 4; +pub const RTNH_F_OFFLOAD: libc::c_uchar = 8; +pub const RTNH_F_LINKDOWN: libc::c_uchar = 16; +pub const RTNH_F_UNRESOLVED: libc::c_uchar = 32; + +pub const RTNH_COMPARE_MASK: libc::c_uchar = RTNH_F_DEAD | RTNH_F_LINKDOWN | RTNH_F_OFFLOAD; + +pub const RTNH_ALIGN: i32 = 4; +#[macro_export] +macro_rules! RTNH_ALIGN { + ($len: expr) => { + (($len as u32 + (RTNH_ALIGN - 1) as u32) & !(RTNH_ALIGN - 1) as u32) + }; +} + +#[macro_export] +macro_rules! RTNH_OK { + ($rtnh: expr, $len: expr) => { + $rtnh.rtnh_len >= mem::size_of::() && $rtnh.rtnh_len <= $len + }; +} + +#[macro_export] +macro_rules! RTNH_NEXT { + ($rtnh: expr) => { + unsafe { + let mut p = $rtnh as *mut rtnexthop as i64; + p += RTNH_ALIGN!($rtnh.rtnh_len); + p as *mut rtnexthop + } + }; +} + +#[macro_export] +macro_rules! RTNH_LENGTH { + ($len: expr) => { + RTNH_ALIGN!(mem::size_of::()) + $len + }; +} + +#[macro_export] +macro_rules! RTNH_SPACE { + ($len: expr) => { + RTNH_ALIGN!(RTNH_LENGTH!($len)) + }; +} + +#[macro_export] +macro_rules! RTNH_DATA { + ($rtnh: expr) => { + unsafe { + let mut p = $rtnh as *mut rtnexthop as i64; + p += RTNH_LENGTH!(0); + p as *mut rtattr + } + }; +} + +// RTA_VIA +type __kernel_sa_family_t = libc::c_ushort; +#[repr(C)] +#[derive(Copy)] +pub struct rtvia { + rtvia_family: __kernel_sa_family_t, + // array with size 0. omitted here. be careful + // with how to access it. cannot use rtvia.rtvia_addr +} + +impl Clone for rtvia { + fn clone(&self) -> Self { + Self { ..*self } + } +} + +impl Default for rtvia { + fn default() -> Self { + Self { + ..unsafe { mem::zeroed::() } + } + } +} + +// rta_cacheinfo +#[repr(C)] +#[derive(Copy)] +pub struct rta_cacheinfo { + rta_clntref: __u32, + rta_lastuse: __u32, + rta_expires: __u32, + rta_error: __u32, + rta_used: __u32, + + rta_id: __u32, + rta_ts: __u32, + rta_tsage: __u32, +} + +impl Clone for rta_cacheinfo { + fn clone(&self) -> Self { + Self { ..*self } + } +} + +impl Default for rta_cacheinfo { + fn default() -> Self { + Self { + ..unsafe { mem::zeroed::() } + } + } +} + +// RTA_METRICS +pub const RTAX_UNSPEC: libc::c_ushort = 0; +pub const RTAX_LOCK: libc::c_ushort = 1; +pub const RTAX_MTU: libc::c_ushort = 2; +pub const RTAX_WINDOW: libc::c_ushort = 3; +pub const RTAX_RTT: libc::c_ushort = 4; +pub const RTAX_RTTVAR: libc::c_ushort = 5; +pub const RTAX_SSTHRESH: libc::c_ushort = 6; +pub const RTAX_CWND: libc::c_ushort = 7; +pub const RTAX_ADVMSS: libc::c_ushort = 8; +pub const RTAX_REORDERING: libc::c_ushort = 9; +pub const RTAX_HOPLIMIT: libc::c_ushort = 10; +pub const RTAX_INITCWND: libc::c_ushort = 11; +pub const RTAX_FEATURES: libc::c_ushort = 12; +pub const RTAX_RTO_MIN: libc::c_ushort = 13; +pub const RTAX_INITRWND: libc::c_ushort = 14; +pub const RTAX_QUICKACK: libc::c_ushort = 15; +pub const RTAX_CC_ALGO: libc::c_ushort = 16; +pub const RTAX_FASTOPEN_NO_COOKIE: libc::c_ushort = 17; +pub const __RTAX_MAX: libc::c_ushort = 18; + +pub const RTAX_MAX: libc::c_ushort = __RTAX_MAX - 1; +pub const RTAX_FEATURE_ECN: libc::c_ushort = 1 << 0; +pub const RTAX_FEATURE_SACK: libc::c_ushort = 1 << 1; +pub const RTAX_FEATURE_TIMESTAMP: libc::c_ushort = 1 << 2; +pub const RTAX_FEATURE_ALLFRAG: libc::c_ushort = 1 << 3; +pub const RTAX_FEATURE_MASK: libc::c_ushort = + RTAX_FEATURE_ECN | RTAX_FEATURE_SACK | RTAX_FEATURE_TIMESTAMP | RTAX_FEATURE_ALLFRAG; + +// RTA_SESSION +#[repr(C)] +#[derive(Copy)] +pub struct Ports { + sport: __u16, + dport: __u16, +} + +impl Clone for Ports { + fn clone(&self) -> Self { + Self { ..*self } + } +} + +impl Default for Ports { + fn default() -> Self { + Self { + ..unsafe { mem::zeroed::() } + } + } +} + +#[repr(C)] +#[derive(Copy)] +pub struct Icmpt { + r#type: __u8, + code: __u8, + ident: __u16, +} + +impl Clone for Icmpt { + fn clone(&self) -> Self { + Self { ..*self } + } +} + +impl Default for Icmpt { + fn default() -> Self { + Self { + ..unsafe { mem::zeroed::() } + } + } +} + +#[repr(C)] +#[derive(Copy)] +pub union U { + pub ports: Ports, + pub icmpt: Icmpt, + spi: __u32, +} + +impl Clone for U { + fn clone(&self) -> Self { + Self { + spi: unsafe { self.spi }, + } + } +} + +impl Default for U { + fn default() -> Self { + let s = unsafe { mem::zeroed::() }; + Self { + spi: unsafe { s.spi }, + } + } +} + +#[repr(C)] +#[derive(Copy)] +pub struct rta_session { + proto: __u8, + pad1: __u8, + pad2: __u16, + u: U, +} + +impl Clone for rta_session { + fn clone(&self) -> Self { + Self { ..*self } + } +} + +impl Default for rta_session { + fn default() -> Self { + Self { + ..unsafe { mem::zeroed::() } + } + } +} + +#[repr(C)] +#[derive(Copy)] +pub struct rta_mfc_stats { + mfcs_packets: __u64, + mfcs_bytes: __u64, + mfcs_wrong_if: __u64, +} + +impl Clone for rta_mfc_stats { + fn clone(&self) -> Self { + Self { ..*self } + } +} + +impl Default for rta_mfc_stats { + fn default() -> Self { + Self { + ..unsafe { mem::zeroed::() } + } + } +} + +#[repr(C)] +#[derive(Copy)] +pub struct ifinfomsg { + ifi_family: libc::c_uchar, + __ifi_pad: libc::c_uchar, + ifi_type: libc::c_ushort, + ifi_index: libc::c_int, + ifi_flags: libc::c_uint, + ifi_change: libc::c_uint, +} + +impl Clone for ifinfomsg { + fn clone(&self) -> Self { + Self { ..*self } + } +} + +impl Default for ifinfomsg { + fn default() -> Self { + Self { + ..unsafe { mem::zeroed::() } + } + } +} + +#[repr(C)] +#[derive(Copy)] +pub struct rtnl_link_stats64 { + rx_packets: __u64, + tx_packets: __u64, + rx_bytes: __u64, + tx_bytes: __u64, + rx_errors: __u64, + tx_errors: __u64, + rx_dropped: __u64, + tx_dropped: __u64, + multicast: __u64, + collisions: __u64, + + // detailed rx_errors + rx_length_errors: __u64, + rx_over_errors: __u64, + rx_crc_errors: __u64, + rx_frame_errrors: __u64, + rx_fifo_errors: __u64, + rx_missed_errors: __u64, + + // detailed tx_errors + tx_aborted_errors: __u64, + tx_carrier_errors: __u64, + tx_fifo_errors: __u64, + tx_heartbeat_errors: __u64, + tx_window_errors: __u64, + + rx_compressed: __u64, + tx_compressed: __u64, + rx_nohandler: __u64, +} + +impl Clone for rtnl_link_stats64 { + fn clone(&self) -> Self { + Self { ..*self } + } +} + +impl Default for rtnl_link_stats64 { + fn default() -> Self { + Self { + ..unsafe { mem::zeroed::() } + } + } +} + +#[repr(C)] +#[derive(Copy)] +pub struct rtnl_link_stats { + rx_packets: __u32, + tx_packets: __u32, + rx_bytes: __u32, + tx_bytes: __u32, + rx_errors: __u32, + tx_errors: __u32, + rx_dropped: __u32, + tx_dropped: __u32, + multicast: __u32, + collisions: __u32, + + // detailed rx_errors + rx_length_errors: __u32, + rx_over_errors: __u32, + rx_crc_errors: __u32, + rx_frame_errrors: __u32, + rx_fifo_errors: __u32, + rx_missed_errors: __u32, + + // detailed tx_errors + tx_aborted_errors: __u32, + tx_carrier_errors: __u32, + tx_fifo_errors: __u32, + tx_heartbeat_errors: __u32, + tx_window_errors: __u32, + + rx_compressed: __u32, + tx_compressed: __u32, + rx_nohandler: __u32, +} + +impl Clone for rtnl_link_stats { + fn clone(&self) -> Self { + Self { ..*self } + } +} + +impl Default for rtnl_link_stats { + fn default() -> Self { + Self { + ..unsafe { mem::zeroed::() } + } + } +} + +#[repr(C)] +#[derive(Copy)] +pub struct ifaddrmsg { + ifa_family: __u8, + ifa_prefixlen: __u8, + ifa_flags: __u8, + ifa_scope: __u8, + ifa_index: __u32, +} + +impl Clone for ifaddrmsg { + fn clone(&self) -> Self { + Self { ..*self } + } +} + +impl Default for ifaddrmsg { + fn default() -> Self { + Self { + ..unsafe { mem::zeroed::() } + } + } +} + +#[repr(C)] +#[derive(Copy)] +pub struct ifa_cacheinfo { + ifa_prefered: __u32, + ifa_valid: __u32, + cstamp: __u32, + tstamp: __u32, +} + +impl Clone for ifa_cacheinfo { + fn clone(&self) -> Self { + Self { ..*self } + } +} + +impl Default for ifa_cacheinfo { + fn default() -> Self { + Self { + ..unsafe { mem::zeroed::() } + } + } +} + +pub const RTA_ALIGNTO: libc::c_uint = 4; +#[macro_export] +macro_rules! RTA_ALIGN { + ($x: expr) => { + ($x as u32 + (RTA_ALIGNTO - 1) as u32) & !((RTA_ALIGNTO - 1) as u32) + }; +} + +#[macro_export] +macro_rules! RTA_OK { + ($attr: expr, $len: expr) => { + ($len as u32 >= mem::size_of::() as u32) + && ((*$attr).rta_len as u32 >= mem::size_of::() as u32) + && ((*$attr).rta_len as u32 <= $len as u32) + }; +} + +#[macro_export] +macro_rules! RTA_NEXT { + ($attr: expr, $len: expr) => { + unsafe { + $len -= RTA_ALIGN!((*$attr).rta_len) as u32; + let mut p = $attr as *mut libc::c_char as i64; + p += RTA_ALIGN!((*$attr).rta_len) as i64; + p as *mut rtattr + } + }; +} + +#[macro_export] +macro_rules! RTA_LENGTH { + ($len: expr) => { + RTA_ALIGN!($len as u32 + mem::size_of::() as u32) + }; +} + +#[macro_export] +macro_rules! RTA_SPACE { + ($len: expr) => { + RTA_ALIGN!(RTA_LENGTH!($len)) + }; +} + +#[macro_export] +macro_rules! RTA_DATA { + ($attr: expr) => { + unsafe { + let mut p = $attr as *mut libc::c_char as i64; + p += RTA_LENGTH!(0) as i64; + p as *mut libc::c_char + } + }; +} + +#[macro_export] +macro_rules! RTA_PAYLOAD { + ($attr: expr) => { + ((*$attr).rta_len as u32 - RTA_LENGTH!(0) as u32) + }; +} + +pub const NLMSGERR_ATTR_UNUSED: libc::c_uchar = 0; +pub const NLMSGERR_ATTR_MASG: libc::c_uchar = 1; +pub const NLMSGERR_ATTR_OFFS: libc::c_uchar = 2; +pub const NLMSGERR_ATTR_COOKIE: libc::c_uchar = 3; +pub const __NLMSGERR_ATTR_MAX: libc::c_uchar = 4; +pub const NLMSGERR_ATTR_MAX: libc::c_uchar = __NLMSGERR_ATTR_MAX - 1; + +pub const NLMSG_ALIGNTO: libc::c_uint = 4; +#[macro_export] +macro_rules! NLMSG_ALIGN { + ($len: expr) => { + ($len as u32 + NLMSG_ALIGNTO - 1) & !(NLMSG_ALIGNTO - 1) + }; +} + +// weird, static link cannot find libc::nlmsghdr +// define macro here ro work around it for now +// till someone can find out the reason +// pub const NLMSG_HDRLEN: libc::c_int = NLMSG_ALIGN!(mem::size_of::() as libc::c_uint) as libc::c_int; + +#[macro_export] +macro_rules! NLMSG_HDRLEN { + () => { + NLMSG_ALIGN!(mem::size_of::()) + }; +} + +#[macro_export] +macro_rules! NLMSG_LENGTH { + ($len: expr) => { + ($len as u32 + NLMSG_HDRLEN!()) + }; +} + +#[macro_export] +macro_rules! NLMSG_SPACE { + ($len: expr) => { + NLMSG_ALIGN!(NLMSG_LENGTH!($len)) + }; +} + +#[macro_export] +macro_rules! NLMSG_DATA { + ($nlh: expr) => { + unsafe { + let mut p = $nlh as *mut nlmsghdr as i64; + p += NLMSG_LENGTH!(0) as i64; + p as *mut libc::c_void + } + }; +} + +#[macro_export] +macro_rules! NLMSG_NEXT { + ($nlh: expr, $len: expr) => { + unsafe { + $len -= NLMSG_ALIGN!((*$nlh).nlmsg_len) as u32; + let mut p = $nlh as *mut libc::c_char; + p = (p as i64 + NLMSG_ALIGN!((*$nlh).nlmsg_len) as i64) as *mut libc::c_char; + p as *mut nlmsghdr + } + }; +} + +#[macro_export] +macro_rules! NLMSG_OK { + ($nlh: expr, $len: expr) => { + $len as usize >= mem::size_of::() + && (*$nlh).nlmsg_len as usize >= mem::size_of::() + && (*$nlh).nlmsg_len as usize <= $len as usize + }; +} + +#[macro_export] +macro_rules! NLMSG_PAYLOAD { + ($nlh: expr, $len: expr) => { + ((*$nlh).nlmsg_len - NLMSG_SPACE!($len)) + }; +} + +#[macro_export] +macro_rules! RTA_TAIL { + ($attr: expr) => { + unsafe { + let mut p = $attr as *mut rtattr as i64; + p += RTA_ALIGN!($attr->rta_len) as i64; + p as *mut rtattr + } + } +} + +#[macro_export] +macro_rules! NLMSG_TAIL { + ($msg: expr) => { + unsafe { + let mut p = $msg as *mut nlmsghdr as i64; + p += NLMSG_ALIGN!((*$msg).nlmsg_len) as i64; + p as *mut rtattr + } + }; +} + +#[macro_export] +macro_rules! IFA_RTA { + ($ifmsg: expr) => { + unsafe { + let mut p = $ifmsg as *mut ifaddrmsg as *mut libc::c_char; + p = (p as i64 + NLMSG_ALIGN!(mem::size_of::()) as i64) as *mut libc::c_char; + p as *mut rtattr + } + }; +} + +#[macro_export] +macro_rules! IFA_PAYLOAD { + ($h: expr) => { + NLMSG_PAYLOAD!($h, mem::size_of::()) + }; +} + +#[macro_export] +macro_rules! IFLA_RTA { + ($ifinfo: expr) => { + unsafe { + let mut p = $ifinfo as *mut ifinfomsg as i64; + p += NLMSG_ALIGN!(mem::size_of::()) as i64; + p as *mut rtattr + } + }; +} + +#[macro_export] +macro_rules! IFLA_PAYLOAD { + ($h: expr) => { + (NLMSG_PAYLOAD!($h, mem::size_of::())) + }; +} + +#[macro_export] +macro_rules! IFLA_STATS_RTA { + ($stats: expr) => { + unsafe { + let mut p = $stats as *mut if_stats_msg as i64; + p += NLMSG_ALIGN!(mem::size_of::()) as i64; + p as *mut rtattr + } + }; +} + +#[repr(C)] +#[derive(Copy)] +pub struct nlmsghdr { + pub nlmsg_len: __u32, + pub nlmsg_type: __u16, + pub nlmsg_flags: __u16, + pub nlmsg_seq: __u32, + pub nlmsg_pid: __u32, +} + +impl Clone for nlmsghdr { + fn clone(&self) -> Self { + Self { ..*self } + } +} + +impl Default for nlmsghdr { + fn default() -> Self { + unsafe { mem::zeroed::() } + } +} + +// nlmsg_flags +pub const NLM_F_REQUEST: __u16 = 0x01; +pub const NLM_F_MULTI: __u16 = 0x02; +pub const NLM_F_ACK: __u16 = 0x04; +pub const NLM_F_ECHO: __u16 = 0x08; +pub const NLM_F_DUMP_INTR: __u16 = 0x10; +pub const NLM_F_DUMP_FILTERED: __u16 = 0x20; + +// Get Request +pub const NLM_F_ROOT: __u16 = 0x100; +pub const NLM_F_MATCH: __u16 = 0x200; +pub const NLM_F_ATOMIC: __u16 = 0x400; +pub const NLM_F_DUMP: __u16 = NLM_F_ROOT | NLM_F_MATCH; + +// New Request +pub const NLM_F_REPLACE: __u16 = 0x100; +pub const NLM_F_EXCL: __u16 = 0x200; +pub const NLM_F_CREATE: __u16 = 0x400; +pub const NLM_F_APPEND: __u16 = 0x800; + +// Delete Request +pub const NLM_F_NONREC: __u16 = 0x100; + +//ACK message +pub const NLM_F_CAPPED: __u16 = 0x100; +pub const NLM_F_ACK_TLVS: __u16 = 0x200; + +// error message type +pub const NLMSG_NOOP: __u16 = 0x1; +pub const NLMSG_ERROR: __u16 = 0x2; +pub const NLMSG_DONE: __u16 = 0x3; +pub const NLMSG_OVERRUN: __u16 = 0x4; + +pub const NLMSG_MIN_TYPE: __u16 = 0x10; + +// IFLA_EXT_MASK +pub const RTEXT_FILTER_VF: __u32 = 1 << 0; +pub const RTEXT_FILTER_BRVLAN: __u32 = 1 << 1; +pub const RTEXT_FILTER_BRVLAN_COMPRESSED: __u32 = 1 << 2; +pub const RTEXT_FILTER_SKIP_STATS: __u32 = 1 << 3; + +// IFLA attr +pub const IFLA_UNSPEC: __u16 = 0; +pub const IFLA_ADDRESS: __u16 = 1; +pub const IFLA_BROADCAST: __u16 = 2; +pub const IFLA_IFNAME: __u16 = 3; +pub const IFLA_MTU: __u16 = 4; +pub const IFLA_LINK: __u16 = 5; +pub const IFLA_QDISC: __u16 = 6; +pub const IFLA_STATS: __u16 = 7; +pub const IFLA_COST: __u16 = 8; +pub const IFLA_PRIORITY: __u16 = 9; +pub const IFLA_MASTER: __u16 = 10; +pub const IFLA_WIRELESS: __u16 = 11; +pub const IFLA_PROTINFO: __u16 = 12; +pub const IFLA_TXQLEN: __u16 = 13; +pub const IFLA_MAP: __u16 = 14; +pub const IFLA_WEIGHT: __u16 = 15; +pub const IFLA_OPERSTATE: __u16 = 16; +pub const IFLA_LINKMODE: __u16 = 17; +pub const IFLA_LINKINFO: __u16 = 18; +pub const IFLA_NET_NS_PID: __u16 = 19; +pub const IFLA_IFALIAS: __u16 = 20; +pub const IFLA_NUM_VF: __u16 = 21; +pub const IFLA_VFINFO_LIST: __u16 = 22; +pub const IFLA_STATS64: __u16 = 23; +pub const IFLA_VF_PORTS: __u16 = 24; +pub const IFLA_PORT_SELF: __u16 = 25; +pub const IFLA_AF_SPEC: __u16 = 26; +pub const IFLA_GROUP: __u16 = 27; +pub const IFLA_NET_NS_FD: __u16 = 28; +pub const IFLA_EXT_MASK: __u16 = 29; +pub const IFLA_PROMISCUITY: __u16 = 30; +pub const IFLA_NUM_TX_QUEUES: __u16 = 31; +pub const IFLA_NUM_RX_QUEUES: __u16 = 32; +pub const IFLA_CARRIER: __u16 = 33; +pub const IFLA_PHYS_PORT_ID: __u16 = 34; +pub const IFLA_CARRIER_CHANGES: __u16 = 35; +pub const IFLA_PHYS_SWITCH_ID: __u16 = 36; +pub const IFLA_LINK_NETNSID: __u16 = 37; +pub const IFLA_PHYS_PORT_NAME: __u16 = 38; +pub const IFLA_PROTO_DOWN: __u16 = 39; +pub const IFLA_GSO_MAX_SEGS: __u16 = 40; +pub const IFLA_GSO_MAX_SIZE: __u16 = 41; +pub const IFLA_PAD: __u16 = 42; +pub const IFLA_XDP: __u16 = 43; +pub const IFLA_EVENT: __u16 = 44; +pub const IFLA_NEW_NETNSID: __u16 = 45; +pub const IFLA_IF_NETNSID: __u16 = 46; +pub const IFLA_CARRIER_UP_COUNT: __u16 = 47; +pub const IFLA_CARRIER_DOWN_COUNT: __u16 = 48; +pub const IFLA_NEW_IFINDEX: __u16 = 49; +pub const IFLA_MIN_MTU: __u16 = 50; +pub const IFLA_MAX_MTU: __u16 = 51; +pub const __IFLA_MAX: __u16 = 52; +pub const IFLA_MAX: __u16 = __IFLA_MAX - 1; + +pub const IFA_UNSPEC: __u16 = 0; +pub const IFA_ADDRESS: __u16 = 1; +pub const IFA_LOCAL: __u16 = 2; +pub const IFA_LABEL: __u16 = 3; +pub const IFA_BROADCAST: __u16 = 4; +pub const IFA_ANYCAST: __u16 = 5; +pub const IFA_CACHEINFO: __u16 = 6; +pub const IFA_MULTICAST: __u16 = 7; +pub const IFA_FLAGS: __u16 = 8; +pub const IFA_RT_PRIORITY: __u16 = 9; +pub const __IFA_MAX: __u16 = 10; +pub const IFA_MAX: __u16 = __IFA_MAX - 1; + +// ifa_flags +pub const IFA_F_SECONDARY: __u32 = 0x01; +pub const IFA_F_TEMPORARY: __u32 = IFA_F_SECONDARY; +pub const IFA_F_NODAD: __u32 = 0x02; +pub const IFA_F_OPTIMISTIC: __u32 = 0x04; +pub const IFA_F_DADFAILED: __u32 = 0x08; +pub const IFA_F_HOMEADDRESS: __u32 = 0x10; +pub const IFA_F_DEPRECATED: __u32 = 0x20; +pub const IFA_F_TENTATIVE: __u32 = 0x40; +pub const IFA_F_PERMANENT: __u32 = 0x80; +pub const IFA_F_MANAGETEMPADDR: __u32 = 0x100; +pub const IFA_F_NOPREFIXROUTE: __u32 = 0x200; +pub const IFA_F_MCAUTOJOIN: __u32 = 0x400; +pub const IFA_F_STABLE_PRIVACY: __u32 = 0x800; + +#[repr(C)] +#[derive(Copy)] +pub struct nlmsgerr { + pub error: libc::c_int, + pub msg: nlmsghdr, +} + +impl Clone for nlmsgerr { + fn clone(&self) -> Self { + Self { ..*self } + } +} + +impl Default for nlmsgerr { + fn default() -> Self { + unsafe { mem::zeroed::() } + } +} + +// #[derive(Copy)] +pub struct RtnlHandle { + pub fd: libc::c_int, + local: libc::sockaddr_nl, + seq: __u32, + dump: __u32, +} + +impl Clone for RtnlHandle { + fn clone(&self) -> Self { + Self { ..*self } + } +} + +impl Default for RtnlHandle { + fn default() -> Self { + Self { + ..unsafe { mem::zeroed::() } + } + } +} + +impl fmt::Debug for RtnlHandle { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + write!( + f, + "fd: {}\nadrr:{{pid: {}, family: {}}}\nseq:{}\ndump:{}", + self.fd, self.local.nl_family, self.local.nl_pid, self.seq, self.dump + ) + } +} + +pub const NETLINK_ROUTE: libc::c_int = 0; +pub const NETLINK_EXT_ACK: libc::c_int = 11; +pub const NETLINK_UEVENT: libc::c_int = 15; + +impl RtnlHandle { + pub fn new(protocal: libc::c_int, group: u32) -> Result { + // open netlink_route socket + let mut sa: libc::sockaddr_nl = unsafe { mem::zeroed::() }; + let fd = unsafe { + let tmpfd = libc::socket( + libc::AF_NETLINK, + libc::SOCK_DGRAM | libc::SOCK_CLOEXEC, + protocal, + ); + + let sndbuf: libc::c_int = 32768; + let rcvbuf: libc::c_int = 1024 * 1024; + let one: libc::c_int = 1; + let mut addrlen: libc::socklen_t = + mem::size_of::() as libc::socklen_t; + + if tmpfd < 0 { + return Err(ErrorKind::Nix(nix::Error::Sys(Errno::last())).into()); + } + + let mut err = libc::setsockopt( + tmpfd, + libc::SOL_SOCKET, + libc::SO_SNDBUF, + &sndbuf as *const libc::c_int as *const libc::c_void, + mem::size_of::() as libc::socklen_t, + ); + + if err < 0 { + libc::close(tmpfd); + return Err(ErrorKind::Nix(nix::Error::Sys(Errno::last())).into()); + } + + err = libc::setsockopt( + tmpfd, + libc::SOL_SOCKET, + libc::SO_RCVBUF, + &rcvbuf as *const libc::c_int as *const libc::c_void, + mem::size_of::() as libc::socklen_t, + ); + + if err < 0 { + libc::close(tmpfd); + return Err(ErrorKind::Nix(nix::Error::Sys(Errno::last())).into()); + } + + libc::setsockopt( + tmpfd, + libc::SOL_NETLINK, + NETLINK_EXT_ACK, + &one as *const libc::c_int as *const libc::c_void, + mem::size_of::() as libc::socklen_t, + ); + + sa.nl_family = libc::AF_NETLINK as __u16; + sa.nl_groups = group; + + err = libc::bind( + tmpfd, + (&sa as *const libc::sockaddr_nl) as *const libc::sockaddr, + mem::size_of::() as libc::socklen_t, + ); + if err < 0 { + libc::close(tmpfd); + return Err(ErrorKind::Nix(nix::Error::Sys(Errno::last())).into()); + } + + err = libc::getsockname( + tmpfd, + &mut sa as *mut libc::sockaddr_nl as *mut libc::sockaddr, + &mut addrlen as *mut libc::socklen_t, + ); + if err < 0 { + libc::close(tmpfd); + return Err(ErrorKind::Nix(nix::Error::Sys(Errno::last())).into()); + } + + if sa.nl_family as i32 != libc::AF_NETLINK + || addrlen as usize != mem::size_of::() + { + libc::close(tmpfd); + return Err(ErrorKind::Nix(nix::Error::Sys(Errno::EINVAL)).into()); + } + + tmpfd + }; + + Ok(Self { + fd, + local: sa, + seq: unsafe { libc::time(0 as *mut libc::time_t) } as __u32, + dump: 0, + }) + } + + // implement update{interface,routes}, list{interface, routes} + fn send_message(&self, data: &mut [u8]) -> Result<()> { + let mut sa: libc::sockaddr_nl = unsafe { mem::zeroed::() }; + + sa.nl_family = libc::AF_NETLINK as u16; + + unsafe { + let nh = data.as_mut_ptr() as *mut nlmsghdr; + let mut iov: libc::iovec = libc::iovec { + iov_base: nh as *mut libc::c_void, + iov_len: (*nh).nlmsg_len as libc::size_t, + }; + + let mut h = mem::zeroed::(); + h.msg_name = &mut sa as *mut libc::sockaddr_nl as *mut libc::c_void; + h.msg_namelen = mem::size_of::() as libc::socklen_t; + h.msg_iov = &mut iov as *mut libc::iovec; + h.msg_iovlen = 1; + + let err = libc::sendmsg(self.fd, &h as *const libc::msghdr, 0); + + if err < 0 { + return Err(ErrorKind::Nix(nix::Error::Sys(Errno::last())).into()); + } + } + Ok(()) + } + + pub fn recv_message(&self) -> Result> { + let mut sa: libc::sockaddr_nl = unsafe { mem::zeroed::() }; + + let mut iov = libc::iovec { + iov_base: 0 as *mut libc::c_void, + iov_len: 0 as libc::size_t, + }; + + unsafe { + let mut h = mem::zeroed::(); + h.msg_name = &mut sa as *mut libc::sockaddr_nl as *mut libc::c_void; + h.msg_namelen = mem::size_of::() as libc::socklen_t; + h.msg_iov = &mut iov as *mut libc::iovec; + h.msg_iovlen = 1; + + let mut rlen = libc::recvmsg( + self.fd, + &mut h as *mut libc::msghdr, + libc::MSG_PEEK | libc::MSG_TRUNC, + ); + + if rlen < 0 { + return Err(ErrorKind::Nix(nix::Error::Sys(Errno::last())).into()); + } + + // if rlen < 32768 { + // rlen = 32768; + // } + + let mut v: Vec = vec![0; rlen as usize]; + // v.set_len(rlen as usize); + + iov.iov_base = v.as_mut_ptr() as *mut libc::c_void; + iov.iov_len = rlen as libc::size_t; + + rlen = libc::recvmsg(self.fd, &mut h as *mut libc::msghdr, 0); + if rlen < 0 { + return Err(ErrorKind::Nix(nix::Error::Sys(Errno::last())).into()); + } + + if sa.nl_pid != 0 { + // not our netlink message + return Err(ErrorKind::Nix(nix::Error::Sys(Errno::EBADMSG)).into()); + } + + if h.msg_flags & libc::MSG_TRUNC != 0 { + return Err(ErrorKind::Nix(nix::Error::Sys(Errno::EBADMSG)).into()); + } + + v.resize(rlen as usize, 0); + + Ok(v) + } + } + + unsafe fn recv_dump_message(&self) -> Result<(Vec>, Vec<*const nlmsghdr>)> { + let mut slv: Vec> = Vec::new(); + let mut lv: Vec<*const nlmsghdr> = Vec::new(); + + loop { + let buf = self.recv_message()?; + + let mut msglen = buf.len() as u32; + let mut nlh = buf.as_ptr() as *const nlmsghdr; + let mut dump_intr = 0; + let mut done = 0; + + while NLMSG_OK!(nlh, msglen) { + if (*nlh).nlmsg_pid != self.local.nl_pid || (*nlh).nlmsg_seq != self.dump { + nlh = NLMSG_NEXT!(nlh, msglen); + continue; + } + + // got one nlmsg + if (*nlh).nlmsg_flags & NLM_F_DUMP_INTR > 0 { + dump_intr = 1; + } + + if (*nlh).nlmsg_type == NLMSG_DONE { + done = 1; + } + + if (*nlh).nlmsg_type == NLMSG_ERROR { + // error message, better to return + // error code in error messages + + if (*nlh).nlmsg_len < NLMSG_LENGTH!(mem::size_of::()) { + // truncated + return Err(ErrorKind::ErrorCode("truncated message".to_string()).into()); + } + + let el: *const nlmsgerr = NLMSG_DATA!(nlh) as *const nlmsgerr; + return Err( + ErrorKind::Nix(nix::Error::Sys(Errno::from_i32(-(*el).error))).into(), + ); + } + + lv.push(nlh); + + if done == 1 { + break; + } + + nlh = NLMSG_NEXT!(nlh, msglen); + } + + slv.push(buf); + + if done == 1 { + if dump_intr == 1 { + info!(sl!(), "dump interuppted, maybe incomplete"); + } + + break; + } + + // still remain some bytes? + + if msglen != 0 { + return Err(ErrorKind::Nix(nix::Error::Sys(Errno::EINVAL)).into()); + } + } + Ok((slv, lv)) + } + + pub fn list_interfaces(&mut self) -> Result> { + let mut ifaces: Vec = Vec::new(); + + unsafe { + // get link info + let (_slv, lv) = self.dump_all_links()?; + + // get addrinfo + let (_sav, av) = self.dump_all_addresses(0)?; + + // got all the link message and address message + // into lv and av repectively, parse attributes + for link in &lv { + let nlh: *const nlmsghdr = *link; + let ifi: *const ifinfomsg = NLMSG_DATA!(nlh) as *const ifinfomsg; + + if (*nlh).nlmsg_type != RTM_NEWLINK && (*nlh).nlmsg_type != RTM_DELLINK { + continue; + } + + if (*nlh).nlmsg_len < NLMSG_SPACE!(mem::size_of::()) { + info!( + sl!(), + "invalid nlmsg! nlmsg_len: {}, nlmsg_space: {}", + (*nlh).nlmsg_len, + NLMSG_SPACE!(mem::size_of::()) + ); + break; + } + + let rta: *mut rtattr = IFLA_RTA!(ifi) as *mut rtattr; + let rtalen = IFLA_PAYLOAD!(nlh) as u32; + + let attrs = parse_attrs(rta, rtalen, (IFLA_MAX + 1) as usize)?; + + // fill out some fields of Interface, + let mut iface: Interface = Interface::default(); + + if attrs[IFLA_IFNAME as usize] as i64 != 0 { + let t = attrs[IFLA_IFNAME as usize]; + iface.name = String::from_utf8(getattr_var(t as *const rtattr))?; + } + + if attrs[IFLA_MTU as usize] as i64 != 0 { + let t = attrs[IFLA_MTU as usize]; + iface.mtu = getattr32(t) as u64; + } + + if attrs[IFLA_ADDRESS as usize] as i64 != 0 { + let alen = RTA_PAYLOAD!(attrs[IFLA_ADDRESS as usize]); + let a: *const u8 = RTA_DATA!(attrs[IFLA_ADDRESS as usize]) as *const u8; + iface.hwAddr = format_address(a, alen as u32)?; + } + + // get ip address info from av + let mut ads: Vec = Vec::new(); + + for address in &av { + let alh: *const nlmsghdr = *address; + let ifa: *const ifaddrmsg = NLMSG_DATA!(alh) as *const ifaddrmsg; + let arta: *mut rtattr = IFA_RTA!(ifa) as *mut rtattr; + + if (*alh).nlmsg_type != RTM_NEWADDR { + continue; + } + + let tlen = NLMSG_SPACE!(mem::size_of::()); + if (*alh).nlmsg_len < tlen { + info!( + sl!(), + "invalid nlmsg! nlmsg_len: {}, nlmsg_space: {}", + (*alh).nlmsg_len, + tlen + ); + break; + } + + let artalen = IFA_PAYLOAD!(alh) as u32; + + if (*ifa).ifa_index as u32 == (*ifi).ifi_index as u32 { + // found target addresses + // parse attributes and fill out Interface + let addrs = parse_attrs(arta, artalen, (IFA_MAX + 1) as usize)?; + // fill address field of Interface + let mut one: IPAddress = IPAddress::default(); + let mut tattr: *const rtattr = addrs[IFA_LOCAL as usize]; + if addrs[IFA_ADDRESS as usize] as i64 != 0 { + tattr = addrs[IFA_ADDRESS as usize]; + } + + one.mask = format!("{}", (*ifa).ifa_prefixlen); + let a: *const u8 = RTA_DATA!(tattr) as *const u8; + let alen = RTA_PAYLOAD!(tattr); + one.family = IPFamily::v4; + + if (*ifa).ifa_family == libc::AF_INET6 as u8 { + one.family = IPFamily::v6; + } + + // only handle IPv4 for now + // if (*ifa).ifa_family == libc::AF_INET as u8{ + one.address = format_address(a, alen as u32)?; + //} + + ads.push(one); + } + } + + iface.IPAddresses = RepeatedField::from_vec(ads); + ifaces.push(iface); + } + } + + Ok(ifaces) + } + + unsafe fn dump_all_links(&mut self) -> Result<(Vec>, Vec<*const nlmsghdr>)> { + let mut v: Vec = vec![0; 2048]; + let p = v.as_mut_ptr() as *mut libc::c_char; + let nlh: *mut nlmsghdr = p as *mut nlmsghdr; + let ifi: *mut ifinfomsg = NLMSG_DATA!(nlh) as *mut ifinfomsg; + + (*nlh).nlmsg_len = NLMSG_LENGTH!(mem::size_of::() as i32) as __u32; + (*nlh).nlmsg_type = RTM_GETLINK; + (*nlh).nlmsg_flags = (NLM_F_DUMP | NLM_F_REQUEST) as __u16; + + self.seq += 1; + self.dump = self.seq; + (*nlh).nlmsg_seq = self.seq; + + (*ifi).ifi_family = libc::AF_UNSPEC as u8; + + addattr32(nlh, IFLA_EXT_MASK, RTEXT_FILTER_VF); + + self.send_message(v.as_mut_slice())?; + self.recv_dump_message() + } + + unsafe fn dump_all_addresses( + &mut self, + ifindex: __u32, + ) -> Result<(Vec>, Vec<*const nlmsghdr>)> { + let mut v: Vec = vec![0; 2048]; + let p = v.as_mut_ptr() as *mut libc::c_char; + let nlh: *mut nlmsghdr = p as *mut nlmsghdr; + let ifa: *mut ifaddrmsg = NLMSG_DATA!(nlh) as *mut ifaddrmsg; + + (*nlh).nlmsg_len = NLMSG_LENGTH!(mem::size_of::()); + (*nlh).nlmsg_type = RTM_GETADDR; + (*nlh).nlmsg_flags = NLM_F_DUMP | NLM_F_REQUEST; + + self.seq += 1; + self.dump = self.seq; + (*nlh).nlmsg_seq = self.seq; + + (*ifa).ifa_family = libc::AF_UNSPEC as u8; + (*ifa).ifa_index = ifindex; + + self.send_message(v.as_mut_slice())?; + + self.recv_dump_message() + } + + fn find_link_by_hwaddr(&mut self, hwaddr: &str) -> Result { + let mut hw: Vec = vec![0; 6]; + unsafe { + //parse out hwaddr in request + let p = hw.as_mut_ptr() as *mut u8; + let (hw0, hw1, hw2, hw3, hw4, hw5) = scan_fmt!(hwaddr, "{x}:{x}:{x}:{x}:{x}:{x}", + [hex u8], [hex u8], [hex u8], [hex u8], [hex u8], + [hex u8])?; + + hw[0] = hw0; + hw[1] = hw1; + hw[2] = hw2; + hw[3] = hw3; + hw[4] = hw4; + hw[5] = hw5; + + // dump out all links + let (_slv, lv) = self.dump_all_links()?; + + for link in &lv { + let nlh: *const nlmsghdr = *link; + let ifi: *const ifinfomsg = NLMSG_DATA!(nlh) as *const ifinfomsg; + + if (*nlh).nlmsg_type != RTM_NEWLINK && (*nlh).nlmsg_type != RTM_DELLINK { + continue; + } + + if (*nlh).nlmsg_len < NLMSG_SPACE!(mem::size_of::()) { + info!( + sl!(), + "invalid nlmsg! nlmsg_len: {}, nlmsg_space: {}", + (*nlh).nlmsg_len, + NLMSG_SPACE!(mem::size_of::()) + ); + break; + } + + let rta: *mut rtattr = IFLA_RTA!(ifi) as *mut rtattr; + let rtalen = IFLA_PAYLOAD!(nlh) as u32; + + let attrs = parse_attrs(rta, rtalen, (IFLA_MAX + 1) as usize)?; + + // find the target ifinfomsg + if attrs[IFLA_ADDRESS as usize] as i64 != 0 { + let a = RTA_DATA!(attrs[IFLA_ADDRESS as usize]) as *const libc::c_void; + if libc::memcmp( + p as *const libc::c_void, + a, + RTA_PAYLOAD!(attrs[IFLA_ADDRESS as usize]) as libc::size_t, + ) == 0 + { + return Ok(ifinfomsg { ..*ifi }); + } + } + } + } + + return Err(ErrorKind::Nix(nix::Error::Sys(Errno::ENODEV)).into()); + } + + fn find_link_by_name(&mut self, name: &str) -> Result { + let mut v: Vec = vec![0; 2048]; + unsafe { + let mut nlh: *mut nlmsghdr = v.as_mut_ptr() as *mut nlmsghdr; + let mut ifi: *mut ifinfomsg = NLMSG_DATA!(nlh) as *mut ifinfomsg; + + (*nlh).nlmsg_len = NLMSG_LENGTH!(mem::size_of::()) as __u32; + (*nlh).nlmsg_type = RTM_GETLINK; + (*nlh).nlmsg_flags = NLM_F_REQUEST; + + self.seq += 1; + (*nlh).nlmsg_seq = self.seq; + + (*ifi).ifi_family = libc::AF_UNSPEC as u8; + + addattr_var( + nlh, + IFLA_IFNAME, + name.as_ptr() as *const u8, + (name.len() + 1), + ); + + addattr32( + nlh, + IFLA_EXT_MASK, + RTEXT_FILTER_VF | RTEXT_FILTER_SKIP_STATS, + ); + + let mut retv = self.rtnl_talk(v.as_mut_slice(), true)?; + + nlh = retv.as_mut_ptr() as *mut nlmsghdr; + ifi = NLMSG_DATA!(nlh) as *mut ifinfomsg; + + return Ok(ifinfomsg { ..*ifi }); + } + } + + fn rtnl_talk(&mut self, data: &mut [u8], answer: bool) -> Result> { + unsafe { + let nlh: *mut nlmsghdr = data.as_mut_ptr() as *mut nlmsghdr; + if !answer { + (*nlh).nlmsg_flags |= NLM_F_ACK; + } + } + + self.send_message(data)?; + unsafe { + loop { + let buf = self.recv_message()?; + let mut msglen = buf.len() as u32; + let mut nlh = buf.as_ptr() as *const nlmsghdr; + + while NLMSG_OK!(nlh, msglen) { + // not for us + + if (*nlh).nlmsg_pid != self.local.nl_pid { + nlh = NLMSG_NEXT!(nlh, msglen); + continue; + } + + if (*nlh).nlmsg_type == NLMSG_ERROR { + // error message, better to return + // error code in error messages + + if (*nlh).nlmsg_len < NLMSG_LENGTH!(mem::size_of::()) { + // truncated + return Err( + ErrorKind::ErrorCode("truncated message".to_string()).into() + ); + } + + let el: *const nlmsgerr = NLMSG_DATA!(nlh) as *const nlmsgerr; + + // this is ack. -_- + if (*el).error == 0 { + return Ok(Vec::new()); + } + + return Err( + ErrorKind::Nix(nix::Error::Sys(Errno::from_i32(-(*el).error))).into(), + ); + } + + // goog message + if answer { + // need to copy out data + + let mut d: Vec = vec![0; (*nlh).nlmsg_len as usize]; + let dp: *mut libc::c_void = d.as_mut_ptr() as *mut libc::c_void; + libc::memcpy( + dp, + nlh as *const libc::c_void, + (*nlh).nlmsg_len as libc::size_t, + ); + return Ok(d); + } else { + return Ok(Vec::new()); + } + } + + if !(NLMSG_OK!(nlh, msglen)) { + return Err(ErrorKind::Nix(nix::Error::Sys(Errno::EINVAL)).into()); + } + } + } + } + + fn set_link_status(&mut self, ifinfo: &ifinfomsg, up: bool) -> Result<()> { + let mut v: Vec = vec![0; 2048]; + unsafe { + let p: *mut u8 = v.as_mut_ptr() as *mut u8; + let mut nlh: *mut nlmsghdr = p as *mut nlmsghdr; + let mut ifi: *mut ifinfomsg = NLMSG_DATA!(nlh) as *mut ifinfomsg; + + (*nlh).nlmsg_len = NLMSG_LENGTH!(mem::size_of::() as u32) as __u32; + (*nlh).nlmsg_type = RTM_NEWLINK; + (*nlh).nlmsg_flags = NLM_F_REQUEST; + + self.seq += 1; + (*nlh).nlmsg_seq = self.seq; + + (*ifi).ifi_family = ifinfo.ifi_family; + (*ifi).ifi_type = ifinfo.ifi_type; + (*ifi).ifi_index = ifinfo.ifi_index; + + (*ifi).ifi_change |= libc::IFF_UP as u32; + + if up { + (*ifi).ifi_flags |= libc::IFF_UP as u32; + } else { + (*ifi).ifi_flags &= !libc::IFF_UP as u32; + } + } + + self.rtnl_talk(v.as_mut_slice(), false)?; + + Ok(()) + } + + fn delete_one_addr(&mut self, ifinfo: &ifinfomsg, addr: &RtIPAddr) -> Result<()> { + let mut v: Vec = vec![0; 2048]; + unsafe { + let p: *mut u8 = v.as_mut_ptr() as *mut u8; + + let mut nlh: *mut nlmsghdr = p as *mut nlmsghdr; + let mut ifa: *mut ifaddrmsg = NLMSG_DATA!(nlh) as *mut ifaddrmsg; + + (*nlh).nlmsg_len = NLMSG_LENGTH!(mem::size_of::() as u32) as __u32; + (*nlh).nlmsg_type = RTM_DELADDR; + (*nlh).nlmsg_flags = NLM_F_REQUEST; + + self.seq += 1; + (*nlh).nlmsg_seq = self.seq; + + (*ifa).ifa_family = addr.ip_family; + (*ifa).ifa_prefixlen = addr.ip_mask; + (*ifa).ifa_index = ifinfo.ifi_index as u32; + + addattr_var( + nlh, + IFA_ADDRESS, + addr.addr.as_ptr() as *const u8, + addr.addr.len(), + ); + } + + // ignore EADDRNOTAVAIL here.. + self.rtnl_talk(v.as_mut_slice(), false)?; + + Ok(()) + } + + fn delete_all_addrs(&mut self, ifinfo: &ifinfomsg, addrs: &Vec) -> Result<()> { + for a in addrs { + self.delete_one_addr(ifinfo, a)?; + } + + Ok(()) + } + + fn get_link_addresses(&mut self, ifinfo: &ifinfomsg) -> Result> { + let mut del_addrs: Vec = Vec::new(); + unsafe { + let (_sav, av) = self.dump_all_addresses(ifinfo.ifi_index as __u32)?; + + for a in &av { + let nlh: *const nlmsghdr = *a; + let ifa: *const ifaddrmsg = NLMSG_DATA!(nlh) as *const ifaddrmsg; + + if (*nlh).nlmsg_type != RTM_NEWADDR { + continue; + } + + let tlen = NLMSG_SPACE!(mem::size_of::()); + if (*nlh).nlmsg_len < tlen { + info!( + sl!(), + "invalid nlmsg! nlmsg_len: {}, nlmsg_space: {}", + (*nlh).nlmsg_len, + tlen + ); + break; + } + + if (*ifa).ifa_flags as u32 & IFA_F_SECONDARY != 0 { + continue; + } + + let rta: *mut rtattr = IFA_RTA!(ifa) as *mut rtattr; + let rtalen = IFA_PAYLOAD!(nlh) as u32; + + if ifinfo.ifi_index as u32 == (*ifa).ifa_index { + let attrs = parse_attrs(rta, rtalen, (IFA_MAX + 1) as usize)?; + let mut t: *const rtattr = attrs[IFA_LOCAL as usize]; + + if attrs[IFA_ADDRESS as usize] as i64 != 0 { + t = attrs[IFA_ADDRESS as usize]; + } + + let addr = getattr_var(t as *const rtattr); + + del_addrs.push(RtIPAddr { + ip_family: (*ifa).ifa_family, + ip_mask: (*ifa).ifa_prefixlen, + addr, + }); + } + } + } + + Ok(del_addrs) + } + + fn add_one_address(&mut self, ifinfo: &ifinfomsg, ip: &RtIPAddr) -> Result<()> { + let mut v: Vec = vec![0; 2048]; + unsafe { + let mut nlh: *mut nlmsghdr = v.as_mut_ptr() as *mut nlmsghdr; + let mut ifa: *mut ifaddrmsg = NLMSG_DATA!(nlh) as *mut ifaddrmsg; + + (*nlh).nlmsg_len = NLMSG_LENGTH!(mem::size_of::() as u32) as __u32; + (*nlh).nlmsg_type = RTM_NEWADDR; + (*nlh).nlmsg_flags = NLM_F_REQUEST | NLM_F_CREATE | NLM_F_EXCL; + self.seq += 1; + (*nlh).nlmsg_seq = self.seq; + + (*ifa).ifa_family = ip.ip_family; + (*ifa).ifa_prefixlen = ip.ip_mask; + (*ifa).ifa_index = ifinfo.ifi_index as __u32; + + addattr_var( + nlh, + IFA_ADDRESS, + ip.addr.as_ptr() as *const u8, + ip.addr.len(), + ); + // don't know why need IFA_LOCAL, without it + // kernel returns -EINVAL... + addattr_var(nlh, IFA_LOCAL, ip.addr.as_ptr() as *const u8, ip.addr.len()); + + self.rtnl_talk(v.as_mut_slice(), false)?; + } + + Ok(()) + } + + pub fn update_interface(&mut self, iface: &Interface) -> Result { + // the reliable way to find link is using hardware address + // as filter. However, hardware filter might not be supported + // by netlink, we may have to dump link list and the find the + // target link. filter using name or family is supported, but + // we cannot use that to find target link. + // let's try if hardware address filter works. -_- + + let ifinfo = self.find_link_by_hwaddr(iface.hwAddr.as_str())?; + + // bring down interface if it is up + + if ifinfo.ifi_flags & libc::IFF_UP as u32 != 0 { + self.set_link_status(&ifinfo, false)?; + } + + // delete all addresses associated with the link + let del_addrs: Vec = self.get_link_addresses(&ifinfo)?; + + self.delete_all_addrs(&ifinfo, del_addrs.as_ref())?; + + // add new ip addresses in request + for grpc_addr in &iface.IPAddresses { + let rtip = RtIPAddr::from(grpc_addr.clone()); + self.add_one_address(&ifinfo, &rtip)?; + } + + // set name, set mtu, IFF_NOARP. in one rtnl_talk. + let mut v: Vec = vec![0; 2048]; + unsafe { + let p: *mut u8 = v.as_mut_ptr() as *mut u8; + let mut nlh: *mut nlmsghdr = p as *mut nlmsghdr; + let mut ifi: *mut ifinfomsg = NLMSG_DATA!(nlh) as *mut ifinfomsg; + + (*nlh).nlmsg_len = NLMSG_LENGTH!(mem::size_of::() as u32) as __u32; + (*nlh).nlmsg_type = RTM_NEWLINK; + (*nlh).nlmsg_flags = NLM_F_REQUEST; + + self.seq += 1; + (*nlh).nlmsg_seq = self.seq; + + (*ifi).ifi_family = ifinfo.ifi_family; + (*ifi).ifi_type = ifinfo.ifi_type; + (*ifi).ifi_index = ifinfo.ifi_index; + + if iface.raw_flags & libc::IFF_NOARP as u32 != 0 { + (*ifi).ifi_change |= libc::IFF_NOARP as u32; + (*ifi).ifi_flags |= libc::IFF_NOARP as u32; + } + + addattr32(nlh, IFLA_MTU, iface.mtu as u32); + + // if str is null terminated, use addattr_var + // otherwise, use addattr_str + addattr_var( + nlh, + IFLA_IFNAME, + iface.name.as_ptr() as *const u8, + iface.name.len(), + ); + // addattr_str(nlh, IFLA_IFNAME, iface.name.as_str()); + } + + self.rtnl_talk(v.as_mut_slice(), false)?; + + let _ = self.set_link_status(&ifinfo, true); + // test remove this link + // let _ = self.remove_interface(iface)?; + + Ok(iface.clone()) + //return Err(ErrorKind::Nix(nix::Error::Sys( + // Errno::EOPNOTSUPP)).into()); + } + + fn remove_interface(&mut self, iface: &Interface) -> Result { + let ifinfo = self.find_link_by_hwaddr(iface.hwAddr.as_str())?; + self.set_link_status(&ifinfo, false)?; + + // delete this link per request + let mut v: Vec = vec![0; 2048]; + unsafe { + let mut nlh: *mut nlmsghdr = v.as_mut_ptr() as *mut nlmsghdr; + let mut ifi: *mut ifinfomsg = NLMSG_DATA!(nlh) as *mut ifinfomsg; + // No attributes needed? + (*nlh).nlmsg_len = NLMSG_LENGTH!(mem::size_of::()) as __u32; + (*nlh).nlmsg_type = RTM_DELLINK; + (*nlh).nlmsg_flags = NLM_F_REQUEST; + + self.seq += 1; + (*nlh).nlmsg_seq = self.seq; + + (*ifi).ifi_family = ifinfo.ifi_family; + (*ifi).ifi_index = ifinfo.ifi_index; + (*ifi).ifi_type = ifinfo.ifi_type; + + self.rtnl_talk(v.as_mut_slice(), false)?; + } + + Ok(iface.clone()) + } + + fn get_name_by_index(&mut self, index: i32) -> Result { + let mut v: Vec = vec![0; 2048]; + let mut i = 0; + unsafe { + while i < 5 { + i += 1; + let mut nlh: *mut nlmsghdr = v.as_mut_ptr() as *mut nlmsghdr; + let mut ifi: *mut ifinfomsg = NLMSG_DATA!(nlh) as *mut ifinfomsg; + + (*nlh).nlmsg_len = NLMSG_LENGTH!(mem::size_of::()) as __u32; + (*nlh).nlmsg_type = RTM_GETLINK; + (*nlh).nlmsg_flags = NLM_F_REQUEST; + + self.seq += 1; + (*nlh).nlmsg_seq = self.seq; + + (*ifi).ifi_index = index; + + addattr32( + nlh, + IFLA_EXT_MASK, + RTEXT_FILTER_VF | RTEXT_FILTER_SKIP_STATS, + ); + + let mut retv = self.rtnl_talk(v.as_mut_slice(), true)?; + + let nlh: *mut nlmsghdr = retv.as_mut_ptr() as *mut nlmsghdr; + let ifi: *mut ifinfomsg = NLMSG_DATA!(nlh) as *mut ifinfomsg; + + if (*nlh).nlmsg_type != RTM_NEWLINK && (*nlh).nlmsg_type != RTM_DELLINK { + info!(sl!(), "wrong message!"); + continue; + } + + let tlen = NLMSG_SPACE!(mem::size_of::()); + if (*nlh).nlmsg_len < tlen { + info!(sl!(), "corrupt message?"); + continue; + } + + let rta: *mut rtattr = IFLA_RTA!(ifi) as *mut rtattr; + let rtalen = IFLA_PAYLOAD!(nlh) as u32; + + let attrs = parse_attrs(rta, rtalen, (IFLA_MAX + 1) as usize)?; + + let t = attrs[IFLA_IFNAME as usize]; + if t as i64 != 0 { + // we have a name + let tdata = getattr_var(t as *const rtattr); + return Ok(String::from_utf8(tdata)?); + } + } + } + + Err(ErrorKind::ErrorCode("no name".to_string()).into()) + } + + pub fn list_routes(&mut self) -> Result> { + // currently, only dump routes from main table for ipv4 + // ie, rtmsg.rtmsg_family = AF_INET, set RT_TABLE_MAIN + // attribute in dump request + // Fix Me: think about othe tables, ipv6.. + let mut rs: Vec = Vec::new(); + + unsafe { + let (_srv, rv) = self.dump_all_route_msgs()?; + + // parse out routes and store in rs + for r in &rv { + let nlh: *const nlmsghdr = *r; + let rtm: *const rtmsg = NLMSG_DATA!(nlh) as *const rtmsg; + + if (*nlh).nlmsg_type != RTM_NEWROUTE && (*nlh).nlmsg_type != RTM_DELROUTE { + info!(sl!(), "not route message!"); + continue; + } + + let tlen = NLMSG_SPACE!(mem::size_of::()); + if (*nlh).nlmsg_len < tlen { + info!( + sl!(), + "invalid nlmsg! nlmsg_len: {}, nlmsg_spae: {}", + (*nlh).nlmsg_len, + tlen + ); + break; + } + + let rta: *mut rtattr = RTM_RTA!(rtm) as *mut rtattr; + + if (*rtm).rtm_table != RT_TABLE_MAIN as u8 { + continue; + } + + let rtalen = RTM_PAYLOAD!(nlh) as u32; + + let attrs = parse_attrs(rta, rtalen, (RTA_MAX + 1) as usize)?; + + let t = attrs[RTA_TABLE as usize]; + if t as i64 != 0 { + let table = getattr32(t); + if table != RT_TABLE_MAIN { + continue; + } + } + // find source, destination, gateway, scope, and + // and device name + + let mut t = attrs[RTA_DST as usize]; + let mut rte: Route = Route::default(); + + // destination + if t as i64 != 0 { + let data: *const u8 = RTA_DATA!(t) as *const u8; + let len = RTA_PAYLOAD!(t) as u32; + rte.dest = format!("{}/{}", format_address(data, len)?, (*rtm).rtm_dst_len); + } + + // gateway + t = attrs[RTA_GATEWAY as usize]; + if t as i64 != 0 { + let data: *const u8 = RTA_DATA!(t) as *const u8; + let len = RTA_PAYLOAD!(t) as u32; + rte.gateway = format_address(data, len)?; + + // for gateway, destination is 0.0.0.0 + rte.dest = "0.0.0.0".to_string(); + } + + // source + t = attrs[RTA_SRC as usize]; + + if t as i64 == 0 { + t = attrs[RTA_PREFSRC as usize]; + } + + if t as i64 != 0 { + let data: *const u8 = RTA_DATA!(t) as *const u8; + let len = RTA_PAYLOAD!(t) as u32; + + rte.source = format_address(data, len)?; + + if (*rtm).rtm_src_len != 0 { + rte.source = format!("{}/{}", rte.source.as_str(), (*rtm).rtm_src_len); + } + } + + // scope + rte.scope = (*rtm).rtm_scope as u32; + + // oif + t = attrs[RTA_OIF as usize]; + if t as i64 != 0 { + let data: *const i32 = RTA_DATA!(t) as *const i32; + assert_eq!(RTA_PAYLOAD!(t), 4); + + /* + + let mut n: Vec = vec![0; libc::IF_NAMESIZE]; + let np: *mut libc::c_char = n.as_mut_ptr() as *mut libc::c_char; + let tn = libc::if_indextoname(*data as u32, + np); + + if tn as i64 == 0 { + info!(sl!(), "no name?"); + } else { + info!(sl!(), "name(indextoname): {}", String::from_utf8(n)?); + } + // std::process::exit(-1); + */ + + rte.device = self + .get_name_by_index(*data) + .unwrap_or("unknown".to_string()); + } + + rs.push(rte); + } + } + + Ok(rs) + } + + unsafe fn dump_all_route_msgs(&mut self) -> Result<(Vec>, Vec<*const nlmsghdr>)> { + let mut v: Vec = vec![0; 2048]; + let mut nlh: *mut nlmsghdr = v.as_mut_ptr() as *mut nlmsghdr; + let mut rtm: *mut rtmsg = NLMSG_DATA!(nlh) as *mut rtmsg; + + (*nlh).nlmsg_len = NLMSG_LENGTH!(mem::size_of::()) as u32; + (*nlh).nlmsg_type = RTM_GETROUTE; + (*nlh).nlmsg_flags = NLM_F_REQUEST | NLM_F_DUMP; + + self.seq += 1; + self.dump = self.seq; + (*nlh).nlmsg_seq = self.seq; + + (*rtm).rtm_family = libc::AF_INET as u8; + (*rtm).rtm_table = RT_TABLE_MAIN as u8; + + addattr32(nlh, RTA_TABLE, RT_TABLE_MAIN); + + self.send_message(v.as_mut_slice())?; + + self.recv_dump_message() + } + + fn get_all_routes(&mut self) -> Result> { + let mut rs: Vec = Vec::new(); + + unsafe { + let (_srv, rv) = self.dump_all_route_msgs()?; + + for r in &rv { + let nlh: *const nlmsghdr = *r; + let rtm: *const rtmsg = NLMSG_DATA!(nlh) as *const rtmsg; + + if (*nlh).nlmsg_type != RTM_NEWROUTE && (*nlh).nlmsg_type != RTM_DELROUTE { + info!(sl!(), "not route message!"); + continue; + } + + let tlen = NLMSG_SPACE!(mem::size_of::()); + if (*nlh).nlmsg_len < tlen { + info!( + sl!(), + "invalid nlmsg! nlmsg_len: {}, nlmsg_spae: {}", + (*nlh).nlmsg_len, + tlen + ); + break; + } + + if (*rtm).rtm_table != RT_TABLE_MAIN as u8 { + continue; + } + + let rta: *mut rtattr = RTM_RTA!(rtm) as *mut rtattr; + let rtalen = RTM_PAYLOAD!(nlh) as u32; + + let attrs = parse_attrs(rta, rtalen, (RTA_MAX + 1) as usize)?; + + let t = attrs[RTA_TABLE as usize]; + if t as i64 != 0 { + let table = getattr32(t); + if table != RT_TABLE_MAIN { + continue; + } + } + + // find source, destination, gateway, scope, and + // and device name + + let mut t = attrs[RTA_DST as usize]; + let mut rte: RtRoute = RtRoute::default(); + + rte.dst_len = (*rtm).rtm_dst_len; + rte.src_len = (*rtm).rtm_src_len; + rte.dest = None; + rte.protocol = (*rtm).rtm_protocol; + // destination + if t as i64 != 0 { + rte.dest = Some(getattr_var(t as *const rtattr)); + } + + // gateway + t = attrs[RTA_GATEWAY as usize]; + if t as i64 != 0 { + rte.gateway = Some(getattr_var(t as *const rtattr)); + if rte.dest.is_none() { + rte.dest = Some(vec![0 as u8; 4]); + } + } + + // source + t = attrs[RTA_SRC as usize]; + + if t as i64 == 0 { + t = attrs[RTA_PREFSRC as usize]; + } + + if t as i64 != 0 { + rte.source = Some(getattr_var(t as *const rtattr)); + } + + // scope + rte.scope = (*rtm).rtm_scope; + + // oif + t = attrs[RTA_OIF as usize]; + if t as i64 != 0 { + rte.index = getattr32(t as *const rtattr) as i32; + } + + rs.push(rte); + } + } + + Ok(rs) + } + + fn delete_all_routes(&mut self, rs: &Vec) -> Result<()> { + for r in rs { + let name = self.get_name_by_index(r.index)?; + if name.as_str().contains("lo") || name.as_str().contains("::1") { + continue; + } + + if r.protocol == RTPROTO_KERNEL { + continue; + } + + self.delete_one_route(r)?; + } + + Ok(()) + } + + fn add_one_route(&mut self, r: &RtRoute) -> Result<()> { + let mut v: Vec = vec![0; 2048]; + + unsafe { + let mut nlh: *mut nlmsghdr = v.as_mut_ptr() as *mut nlmsghdr; + let mut rtm: *mut rtmsg = NLMSG_DATA!(nlh) as *mut rtmsg; + + (*nlh).nlmsg_len = NLMSG_LENGTH!(mem::size_of::()) as u32; + (*nlh).nlmsg_type = RTM_NEWROUTE; + (*nlh).nlmsg_flags = NLM_F_REQUEST | NLM_F_CREATE | NLM_F_EXCL; + + self.seq += 1; + self.dump = self.seq; + (*nlh).nlmsg_seq = self.seq; + + (*rtm).rtm_family = libc::AF_INET as u8; + (*rtm).rtm_table = RT_TABLE_MAIN as u8; + (*rtm).rtm_scope = RT_SCOPE_NOWHERE; + (*rtm).rtm_protocol = RTPROTO_BOOT; + (*rtm).rtm_scope = RT_SCOPE_UNIVERSE; + (*rtm).rtm_type = RTN_UNICAST; + + (*rtm).rtm_dst_len = r.dst_len; + (*rtm).rtm_src_len = r.src_len; + (*rtm).rtm_scope = r.scope; + + if r.source.is_some() { + let len = r.source.as_ref().unwrap().len(); + if r.src_len > 0 { + addattr_var( + nlh, + RTA_SRC, + r.source.as_ref().unwrap().as_ptr() as *const u8, + len, + ); + } else { + addattr_var( + nlh, + RTA_PREFSRC, + r.source.as_ref().unwrap().as_ptr() as *const u8, + len, + ); + } + } + + if r.dest.is_some() { + let len = r.dest.as_ref().unwrap().len(); + addattr_var( + nlh, + RTA_DST, + r.dest.as_ref().unwrap().as_ptr() as *const u8, + len, + ); + } + + if r.gateway.is_some() { + let len = r.gateway.as_ref().unwrap().len(); + addattr_var( + nlh, + RTA_GATEWAY, + r.gateway.as_ref().unwrap().as_ptr() as *const u8, + len, + ); + } + + addattr32(nlh, RTA_OIF, r.index as u32); + + self.rtnl_talk(v.as_mut_slice(), false)?; + } + Ok(()) + } + + fn delete_one_route(&mut self, r: &RtRoute) -> Result<()> { + info!(sl!(), "delete route"); + let mut v: Vec = vec![0; 2048]; + unsafe { + let mut nlh: *mut nlmsghdr = v.as_mut_ptr() as *mut nlmsghdr; + let mut rtm: *mut rtmsg = NLMSG_DATA!(nlh) as *mut rtmsg; + + (*nlh).nlmsg_len = NLMSG_LENGTH!(mem::size_of::()) as u32; + (*nlh).nlmsg_type = RTM_DELROUTE; + (*nlh).nlmsg_flags = NLM_F_REQUEST; + + self.seq += 1; + self.dump = self.seq; + (*nlh).nlmsg_seq = self.seq; + + (*rtm).rtm_family = libc::AF_INET as u8; + (*rtm).rtm_table = RT_TABLE_MAIN as u8; + (*rtm).rtm_scope = RT_SCOPE_NOWHERE; + + (*rtm).rtm_dst_len = r.dst_len; + (*rtm).rtm_src_len = r.src_len; + (*rtm).rtm_scope = r.scope; + + if r.source.is_some() { + let len = r.source.as_ref().unwrap().len(); + if r.src_len > 0 { + addattr_var( + nlh, + RTA_SRC, + r.source.as_ref().unwrap().as_ptr() as *const u8, + len, + ); + } else { + addattr_var( + nlh, + RTA_PREFSRC, + r.source.as_ref().unwrap().as_ptr() as *const u8, + len, + ); + } + } + + if r.dest.is_some() { + let len = r.dest.as_ref().unwrap().len(); + addattr_var( + nlh, + RTA_DST, + r.dest.as_ref().unwrap().as_ptr() as *const u8, + len, + ); + } + + if r.gateway.is_some() { + let len = r.gateway.as_ref().unwrap().len(); + addattr_var( + nlh, + RTA_GATEWAY, + r.gateway.as_ref().unwrap().as_ptr() as *const u8, + len, + ); + } + addattr32(nlh, RTA_OIF, r.index as u32); + + self.rtnl_talk(v.as_mut_slice(), false)?; + } + + Ok(()) + } + + pub fn update_routes(&mut self, rt: &Vec) -> Result> { + let rs = self.get_all_routes()?; + self.delete_all_routes(&rs)?; + + for grpcroute in rt { + if grpcroute.gateway.as_str() == "" { + let r = RtRoute::from(grpcroute.clone()); + self.add_one_route(&r)?; + } + } + + for grpcroute in rt { + if grpcroute.gateway.as_str() != "" { + let r = RtRoute::from(grpcroute.clone()); + self.add_one_route(&r)?; + } + } + + Ok(rt.clone()) + } + pub fn handle_localhost(&mut self) -> Result<()> { + let ifi = self.find_link_by_name("lo")?; + + self.set_link_status(&ifi, true) + } +} + +unsafe fn parse_attrs( + mut rta: *mut rtattr, + mut rtalen: u32, + max: usize, +) -> Result> { + let mut attrs: Vec<*const rtattr> = vec![0 as *const rtattr; max as usize]; + + while RTA_OK!(rta, rtalen) { + let rtype = (*rta).rta_type as usize; + + if rtype < max && attrs[rtype] as i64 == 0 { + attrs[rtype] = rta as *const rtattr; + } + + rta = RTA_NEXT!(rta, rtalen) + } + + Ok(attrs) +} + +unsafe fn addattr_var(mut nlh: *mut nlmsghdr, cat: u16, data: *const u8, len: usize) { + let mut rta: *mut rtattr = NLMSG_TAIL!(nlh) as *mut rtattr; + let alen = RTA_LENGTH!(len) as u16; + + (*rta).rta_type = cat; + (*rta).rta_len = alen; + + if len > 0 { + libc::memcpy( + RTA_DATA!(rta) as *mut libc::c_void, + data as *const libc::c_void, + len, + ); + } + + (*nlh).nlmsg_len = NLMSG_ALIGN!((*nlh).nlmsg_len) + RTA_ALIGN!(alen); +} + +unsafe fn addattr_str(mut nlh: *mut nlmsghdr, cat: u16, data: &str) { + let mut rta: *mut rtattr = NLMSG_TAIL!(nlh) as *mut rtattr; + let len = data.len(); + let alen = RTA_LENGTH!(len + 1) as u16; + let tp: *mut libc::c_void = RTA_DATA!(rta) as *mut libc::c_void; + + (*rta).rta_type = cat; + (*rta).rta_len = alen; + + libc::memcpy( + tp, + data.as_ptr() as *const libc::c_void, + len as libc::size_t, + ); + + (*nlh).nlmsg_len = NLMSG_ALIGN!((*nlh).nlmsg_len) + RTA_ALIGN!(alen); +} + +unsafe fn addattr_size(mut nlh: *mut nlmsghdr, cat: u16, val: u64, size: u8) { + assert_eq!(size == 1 || size == 2 || size == 4 || size == 8, true); + + let mut rta: *mut rtattr = NLMSG_TAIL!(nlh) as *mut rtattr; + (*rta).rta_type = cat; + + if size == 1 { + let data: *mut u8 = RTA_DATA!(rta) as *mut u8; + *data = val as u8; + let len = RTA_LENGTH!(1) as u16; + (*rta).rta_len = len; + } + + if size == 2 { + let data: *mut u16 = RTA_DATA!(rta) as *mut u16; + *data = val as u16; + let len = RTA_LENGTH!(2) as u16; + (*rta).rta_len = len; + } + + if size == 4 { + let data: *mut u32 = RTA_DATA!(rta) as *mut u32; + *data = val as u32; + let len = RTA_LENGTH!(4) as u16; + (*rta).rta_len = len; + } + + if size == 8 { + let data: *mut u64 = RTA_DATA!(rta) as *mut u64; + *data = val as u64; + let len = RTA_LENGTH!(8) as u16; + (*rta).rta_len = len; + } + + (*nlh).nlmsg_len = NLMSG_ALIGN!((*nlh).nlmsg_len) + RTA_ALIGN!((*rta).rta_len); +} + +unsafe fn addattr8(nlh: *mut nlmsghdr, cat: u16, val: u8) { + addattr_size(nlh, cat, val as u64, 1); +} + +unsafe fn addattr16(nlh: *mut nlmsghdr, cat: u16, val: u16) { + addattr_size(nlh, cat, val as u64, 2); +} + +unsafe fn addattr32(nlh: *mut nlmsghdr, cat: u16, val: u32) { + addattr_size(nlh, cat, val as u64, 4); +} + +unsafe fn addattr64(nlh: *mut nlmsghdr, cat: u16, val: u64) { + addattr_size(nlh, cat, val, 8); +} + +unsafe fn getattr_var(rta: *const rtattr) -> Vec { + assert_ne!(rta as i64, 0); + let data: *const libc::c_void = RTA_DATA!(rta) as *const libc::c_void; + let alen: usize = RTA_PAYLOAD!(rta) as usize; + + let mut v: Vec = vec![0; alen]; + let tp: *mut libc::c_void = v.as_mut_ptr() as *mut libc::c_void; + + libc::memcpy(tp, data, alen as libc::size_t); + + v +} + +unsafe fn getattr_size(rta: *const rtattr) -> u64 { + let alen: usize = RTA_PAYLOAD!(rta) as usize; + assert!(alen == 1 || alen == 2 || alen == 4 || alen == 8); + let tp: *const u8 = RTA_DATA!(rta) as *const u8; + + if alen == 1 { + let data: *const u8 = tp as *const u8; + return *data as u64; + } + + if alen == 2 { + let data: *const u16 = tp as *const u16; + return *data as u64; + } + + if alen == 4 { + let data: *const u32 = tp as *const u32; + return *data as u64; + } + + if alen == 8 { + let data: *const u64 = tp as *const u64; + return *data; + } + + panic!("impossible!"); +} + +unsafe fn getattr8(rta: *const rtattr) -> u8 { + let alen = RTA_PAYLOAD!(rta); + assert!(alen == 1); + getattr_size(rta) as u8 +} + +unsafe fn getattr16(rta: *const rtattr) -> u16 { + let alen = RTA_PAYLOAD!(rta); + assert!(alen == 2); + getattr_size(rta) as u16 +} + +unsafe fn getattr32(rta: *const rtattr) -> u32 { + let alen = RTA_PAYLOAD!(rta); + assert!(alen == 4); + getattr_size(rta) as u32 +} + +unsafe fn getattr64(rta: *const rtattr) -> u64 { + let alen = RTA_PAYLOAD!(rta); + assert!(alen == 8); + getattr_size(rta) +} + +unsafe fn format_address(addr: *const u8, len: u32) -> Result { + let mut a: String; + if len == 4 { + // ipv4 + let mut i = 1; + let mut p = addr as i64; + + a = format!("{}", *(p as *const u8)); + while i < len { + p += 1; + i += 1; + a.push_str(format!(".{}", *(p as *const u8)).as_str()); + } + + return Ok(a); + } + + if len == 6 { + // hwaddr + let mut i = 1; + let mut p = addr as i64; + + a = format!("{:0<2X}", *(p as *const u8)); + while i < len { + p += 1; + i += 1; + a.push_str(format!(":{:0<2X}", *(p as *const u8)).as_str()); + } + + return Ok(a); + } + + if len == 16 { + // ipv6 + let p = addr as *const u8 as *const libc::c_void; + let mut ar: [u8; 16] = [0; 16]; + let mut v: Vec = vec![0; 16]; + let dp: *mut libc::c_void = v.as_mut_ptr() as *mut libc::c_void; + libc::memcpy(dp, p, 16); + + ar.copy_from_slice(v.as_slice()); + + return Ok(Ipv6Addr::from(ar).to_string()); + + /* + let l = len / 2; + + a = format!("{:0<4X}", *(p as *const u16)); + + while i < l { + p += 2; + i += 1; + a.push_str(format!(":{:0<4X}", *(p as *const u16)).as_str()); + } + */ + } + + return Err(ErrorKind::Nix(nix::Error::Sys(Errno::EINVAL)).into()); +} + +impl Drop for RtnlHandle { + fn drop(&mut self) { + unsafe { + libc::close(self.fd); + } + } +} + +pub struct RtRoute { + pub dest: Option>, + pub source: Option>, + pub gateway: Option>, + pub index: i32, + pub scope: u8, + pub dst_len: u8, + pub src_len: u8, + pub protocol: u8, +} + +impl Default for RtRoute { + fn default() -> Self { + unsafe { mem::zeroed::() } + } +} + +fn parse_cidripv4(s: &str) -> Result<(Vec, u8)> { + let (a0, a1, a2, a3, len) = scan_fmt!(s, "{}.{}.{}.{}/{}", u8, u8, u8, u8, u8)?; + let ip: Vec = vec![a0, a1, a2, a3]; + Ok((ip, len)) +} + +fn parse_ipv4(s: &str) -> Result> { + let (a0, a1, a2, a3) = scan_fmt!(s, "{}.{}.{}.{}", u8, u8, u8, u8)?; + let ip: Vec = vec![a0, a1, a2, a3]; + + Ok(ip) +} + +fn parse_ipaddr(s: &str) -> Result> { + if let Ok(v6) = Ipv6Addr::from_str(s) { + return Ok(Vec::from(v6.octets().as_ref())); + } + + // v4 + Ok(Vec::from(Ipv4Addr::from_str(s)?.octets().as_ref())) +} + +fn parse_cider(s: &str) -> Result<(Vec, u8)> { + let (addr, mask) = if s.contains("/") { + scan_fmt!(s, "{}/{}", String, u8)? + } else { + (s.to_string(), 0) + }; + + Ok((parse_ipaddr(addr.as_str())?, mask)) +} + +impl From for RtRoute { + fn from(r: Route) -> Self { + // only handle ipv4 + + let index = { + let mut rh = RtnlHandle::new(NETLINK_ROUTE, 0).unwrap(); + rh.find_link_by_name(r.device.as_str()).unwrap().ifi_index + }; + + let (dest, dst_len) = if r.dest.is_empty() { + (Some(vec![0 as u8; 4]), 0) + } else { + let (dst, mask) = parse_cider(r.dest.as_str()).unwrap(); + (Some(dst), mask) + }; + + let (source, src_len) = if r.source.is_empty() { + (None, 0) + } else { + let (src, mask) = parse_cider(r.source.as_str()).unwrap(); + (Some(src), mask) + }; + + let gateway = if r.gateway.is_empty() { + None + } else { + Some(parse_ipaddr(r.gateway.as_str()).unwrap()) + }; + + /* + let (dest, dst_len) = if gateway.is_some() { + (vec![0 as u8; 4], 0) + } else { + (tdest, tdst_len) + }; + */ + Self { + dest, + source, + src_len, + dst_len, + index, + gateway, + scope: r.scope as u8, + protocol: RTPROTO_UNSPEC, + } + } +} + +pub struct RtIPAddr { + pub ip_family: __u8, + pub ip_mask: __u8, + pub addr: Vec, +} + +impl From for RtIPAddr { + fn from(ipi: IPAddress) -> Self { + let ip_family = if ipi.family == IPFamily::v4 { + libc::AF_INET + } else { + libc::AF_INET6 + } as __u8; + + let ip_mask = scan_fmt!(ipi.mask.as_str(), "{}", u8).unwrap(); + + let addr = parse_ipaddr(ipi.address.as_ref()).unwrap(); + + Self { + ip_family, + ip_mask, + addr, + } + } +} + +#[cfg(test)] +mod tests { + use crate::netlink::{nlmsghdr, NLMSG_ALIGNTO, RTA_ALIGNTO, RTM_BASE}; + use libc; + use std::mem; + #[test] + fn test_macro() { + println!("{}", RTA_ALIGN!(10)); + assert_eq!(RTA_ALIGN!(6), 8); + assert_eq!(RTM_FAM!(36), 5); + assert_eq!( + NLMSG_HDRLEN!(), + NLMSG_ALIGN!(mem::size_of::() as libc::c_uint) + ); + } +} diff --git a/src/agent/src/network.rs b/src/agent/src/network.rs new file mode 100644 index 0000000000..a42d2198bb --- /dev/null +++ b/src/agent/src/network.rs @@ -0,0 +1,30 @@ +// Copyright (c) 2019 Ant Financial +// +// SPDX-License-Identifier: Apache-2.0 +// + +use protocols::types::{Interface, Route}; +use std::collections::HashMap; + +// Network fully describes a sandbox network with its interfaces, routes and dns +// related information. +#[derive(Debug, Default)] +pub struct Network { + ifaces: HashMap, + routes: Vec, + dns: Vec, +} + +impl Network { + pub fn new() -> Network { + Network { + ifaces: HashMap::new(), + routes: Vec::new(), + dns: Vec::new(), + } + } + + pub fn set_dns(&mut self, dns: String) { + self.dns.push(dns); + } +} diff --git a/src/agent/src/random.rs b/src/agent/src/random.rs new file mode 100644 index 0000000000..fd6865c733 --- /dev/null +++ b/src/agent/src/random.rs @@ -0,0 +1,30 @@ +// Copyright (c) 2019 Ant Financial +// +// SPDX-License-Identifier: Apache-2.0 +// + +use libc; +use nix::errno::Errno; +use nix::fcntl::{self, OFlag}; +use nix::sys::stat::Mode; +use rustjail::errors::*; +use std::fs; + +pub const RNGDEV: &'static str = "/dev/random"; +pub const RNDADDTOENTCNT: libc::c_int = 0x40045201; +pub const RNDRESEEDRNG: libc::c_int = 0x5207; + +pub fn reseed_rng(data: &[u8]) -> Result<()> { + let len = data.len() as libc::c_long; + fs::write(RNGDEV, data)?; + + let fd = fcntl::open(RNGDEV, OFlag::O_RDWR, Mode::from_bits_truncate(0o022))?; + + let ret = unsafe { libc::ioctl(fd, RNDADDTOENTCNT, &len as *const libc::c_long) }; + let _ = Errno::result(ret).map(drop)?; + + let ret = unsafe { libc::ioctl(fd, RNDRESEEDRNG, 0) }; + let _ = Errno::result(ret).map(drop)?; + + Ok(()) +} diff --git a/src/agent/src/sandbox.rs b/src/agent/src/sandbox.rs new file mode 100644 index 0000000000..40b8da0037 --- /dev/null +++ b/src/agent/src/sandbox.rs @@ -0,0 +1,273 @@ +// Copyright (c) 2019 Ant Financial +// +// SPDX-License-Identifier: Apache-2.0 +// + +//use crate::container::Container; +use crate::mount::{get_mount_fs_type, remove_mounts, TYPEROOTFS}; +use crate::namespace::{setup_persistent_ns, Namespace, NSTYPEIPC, NSTYPEUTS}; +use crate::netlink::{RtnlHandle, NETLINK_ROUTE}; +use crate::network::Network; +use libc::pid_t; +use protocols::agent::OnlineCPUMemRequest; +use regex::Regex; +use rustjail::cgroups; +use rustjail::container::BaseContainer; +use rustjail::container::LinuxContainer; +use rustjail::errors::*; +use rustjail::process::Process; +use slog::Logger; +use std::collections::HashMap; +use std::fs; +use std::sync::mpsc::Sender; + +#[derive(Debug)] +pub struct Sandbox { + pub logger: Logger, + pub id: String, + pub hostname: String, + pub containers: HashMap, + pub network: Network, + pub mounts: Vec, + pub container_mounts: HashMap>, + pub pci_device_map: HashMap, + pub shared_utsns: Namespace, + pub shared_ipcns: Namespace, + pub storages: HashMap, + pub running: bool, + pub no_pivot_root: bool, + enable_grpc_trace: bool, + pub sandbox_pid_ns: bool, + pub sender: Option>, + pub rtnl: Option, +} + +impl Sandbox { + pub fn new(logger: &Logger) -> Result { + let fs_type = get_mount_fs_type("/")?; + let logger = logger.new(o!("subsystem" => "sandbox")); + + Ok(Sandbox { + logger: logger, + id: "".to_string(), + hostname: "".to_string(), + network: Network::new(), + containers: HashMap::new(), + mounts: Vec::new(), + container_mounts: HashMap::new(), + pci_device_map: HashMap::new(), + shared_utsns: Namespace { + path: "".to_string(), + }, + shared_ipcns: Namespace { + path: "".to_string(), + }, + storages: HashMap::new(), + running: false, + no_pivot_root: fs_type.eq(TYPEROOTFS), + enable_grpc_trace: false, + sandbox_pid_ns: false, + sender: None, + rtnl: Some(RtnlHandle::new(NETLINK_ROUTE, 0).unwrap()), + }) + } + + // unset_sandbox_storage will decrement the sandbox storage + // reference counter. If there aren't any containers using + // that sandbox storage, this method will remove the + // storage reference from the sandbox and return 'true, nil' to + // let the caller know that they can clean up the storage + // related directories by calling remove_sandbox_storage + // + // It's assumed that caller is calling this method after + // acquiring a lock on sandbox. + pub fn unset_sandbox_storage(&mut self, path: &str) -> bool { + match self.storages.get_mut(path) { + None => return false, + Some(count) => { + *count -= 1; + if *count < 1 { + self.storages.remove(path); + } + return true; + } + } + } + + // remove_sandbox_storage removes the sandbox storage if no + // containers are using that storage. + // + // It's assumed that caller is calling this method after + // acquiring a lock on sandbox. + pub fn remove_sandbox_storage(&self, path: &str) -> Result<()> { + let mounts = vec![path.to_string()]; + remove_mounts(&mounts)?; + fs::remove_dir_all(path)?; + Ok(()) + } + + // unset_and_remove_sandbox_storage unsets the storage from sandbox + // and if there are no containers using this storage it will + // remove it from the sandbox. + // + // It's assumed that caller is calling this method after + // acquiring a lock on sandbox. + pub fn unset_and_remove_sandbox_storage(&mut self, path: &str) -> Result<()> { + if self.unset_sandbox_storage(path) { + return self.remove_sandbox_storage(path); + } + Ok(()) + } + + pub fn is_running(&self) -> bool { + self.running + } + + pub fn set_hostname(&mut self, hostname: String) { + self.hostname = hostname; + } + + pub fn setup_shared_namespaces(&mut self) -> Result { + // Set up shared IPC namespace + self.shared_ipcns = match setup_persistent_ns(self.logger.clone(), NSTYPEIPC) { + Ok(ns) => ns, + Err(err) => { + return Err(ErrorKind::ErrorCode(format!( + "Failed to setup persisten IPC namespace with error: {}", + &err + )) + .into()) + } + }; + + // Set up shared UTS namespace + self.shared_utsns = match setup_persistent_ns(self.logger.clone(), NSTYPEUTS) { + Ok(ns) => ns, + Err(err) => { + return Err(ErrorKind::ErrorCode(format!( + "Failed to setup persisten UTS namespace with error: {} ", + &err + )) + .into()) + } + }; + + Ok(true) + } + + pub fn add_container(&mut self, c: LinuxContainer) { + self.containers.insert(c.id.clone(), c); + } + + pub fn get_container(&mut self, id: &str) -> Option<&mut LinuxContainer> { + self.containers.get_mut(id) + } + + pub fn find_process<'a>(&'a mut self, pid: pid_t) -> Option<&'a mut Process> { + for (_, c) in self.containers.iter_mut() { + if c.processes.get(&pid).is_some() { + return c.processes.get_mut(&pid); + } + } + + None + } + + // set_sandbox_storage sets the sandbox level reference + // counter for the sandbox storage. + // This method also returns a boolean to let + // callers know if the storage already existed or not. + // It will return true if storage is new. + // + // It's assumed that caller is calling this method after + // acquiring a lock on sandbox. + pub fn set_sandbox_storage(&mut self, path: &str) -> bool { + match self.storages.get_mut(path) { + None => { + self.storages.insert(path.to_string(), 1); + true + } + Some(count) => { + *count += 1; + false + } + } + } + + pub fn destroy(&mut self) -> Result<()> { + for (_, ctr) in &mut self.containers { + ctr.destroy()?; + } + Ok(()) + } + + pub fn online_cpu_memory(&self, req: &OnlineCPUMemRequest) -> Result<()> { + if req.nb_cpus > 0 { + // online cpus + online_cpus(&self.logger, req.nb_cpus as i32)?; + } + + if !req.cpu_only { + // online memory + online_memory(&self.logger)?; + } + + let cpuset = cgroups::fs::get_guest_cpuset()?; + + for (_, ctr) in self.containers.iter() { + info!(self.logger, "updating {}", ctr.id.as_str()); + ctr.cgroup_manager + .as_ref() + .unwrap() + .update_cpuset_path(cpuset.as_str())?; + } + + Ok(()) + } +} + +pub const CPU_ONLINE_PATH: &'static str = "/sys/devices/system/cpu"; +pub const MEMORY_ONLINE_PATH: &'static str = "/sys/devices/system/memory"; +pub const ONLINE_FILE: &'static str = "online"; + +fn online_resources(logger: &Logger, path: &str, pattern: &str, num: i32) -> Result { + let mut count = 0; + let re = Regex::new(pattern)?; + + for e in fs::read_dir(path)? { + let entry = e?; + let tmpname = entry.file_name(); + let name = tmpname.to_str().unwrap(); + let p = entry.path(); + + if re.is_match(name) { + let file = format!("{}/{}", p.to_str().unwrap(), ONLINE_FILE); + info!(logger, "{}", file.as_str()); + let c = fs::read_to_string(file.as_str())?; + + if c.trim().contains("0") { + fs::write(file.as_str(), "1")?; + count += 1; + + if num > 0 && count == num { + break; + } + } + } + } + + if num > 0 { + return Ok(count); + } + + Ok(0) +} + +fn online_cpus(logger: &Logger, num: i32) -> Result { + online_resources(logger, CPU_ONLINE_PATH, r"cpu[0-9]+", num) +} + +fn online_memory(logger: &Logger) -> Result<()> { + online_resources(logger, MEMORY_ONLINE_PATH, r"memory[0-9]+", -1)?; + Ok(()) +} diff --git a/src/agent/src/uevent.rs b/src/agent/src/uevent.rs new file mode 100644 index 0000000000..11ca068c32 --- /dev/null +++ b/src/agent/src/uevent.rs @@ -0,0 +1,141 @@ +// Copyright (c) 2019 Ant Financial +// +// SPDX-License-Identifier: Apache-2.0 +// + +use crate::device::{online_device, ROOT_BUS_PATH, SCSI_BLOCK_SUFFIX, SYSFS_DIR}; +use crate::grpc::SYSFS_MEMORY_ONLINE_PATH; +use crate::netlink::{RtnlHandle, NETLINK_UEVENT}; +use crate::sandbox::Sandbox; +use crate::GLOBAL_DEVICE_WATCHER; +use std::sync::{Arc, Mutex}; +use std::thread; + +pub const U_EVENT_ACTION: &'static str = "ACTION"; +pub const U_EVENT_DEV_PATH: &'static str = "DEVPATH"; +pub const U_EVENT_SUB_SYSTEM: &'static str = "SUBSYSTEM"; +pub const U_EVENT_SEQ_NUM: &'static str = "SEQNUM"; +pub const U_EVENT_DEV_NAME: &'static str = "DEVNAME"; +pub const U_EVENT_INTERFACE: &'static str = "INTERFACE"; + +#[derive(Debug, Default)] +pub struct Uevent { + action: String, + devpath: String, + devname: String, + subsystem: String, + seqnum: String, + interface: String, +} + +fn parse_uevent(message: &str) -> Uevent { + let mut msg_iter = message.split('\0'); + let mut event = Uevent::default(); + + msg_iter.next(); // skip the first value + for arg in msg_iter { + let key_val: Vec<&str> = arg.splitn(2, '=').collect(); + if key_val.len() == 2 { + match key_val[0] { + U_EVENT_ACTION => event.action = String::from(key_val[1]), + U_EVENT_DEV_NAME => event.devname = String::from(key_val[1]), + U_EVENT_SUB_SYSTEM => event.subsystem = String::from(key_val[1]), + U_EVENT_DEV_PATH => event.devpath = String::from(key_val[1]), + U_EVENT_SEQ_NUM => event.seqnum = String::from(key_val[1]), + U_EVENT_INTERFACE => event.interface = String::from(key_val[1]), + _ => (), + } + } + } + + event +} + +pub fn watch_uevents(sandbox: Arc>) { + let sref = sandbox.clone(); + let s = sref.lock().unwrap(); + let logger = s.logger.new(o!("subsystem" => "uevent")); + + thread::spawn(move || { + let rtnl = RtnlHandle::new(NETLINK_UEVENT, 1).unwrap(); + loop { + match rtnl.recv_message() { + Err(e) => { + error!(logger, "receive uevent message failed"; "error" => format!("{}", e)) + } + Ok(data) => { + let text = String::from_utf8(data); + match text { + Err(e) => { + error!(logger, "failed to convert bytes to text"; "error" => format!("{}", e)) + } + Ok(text) => { + let event = parse_uevent(&text); + info!(logger, "got uevent message"; "event" => format!("{:?}", event)); + + // Check if device hotplug event results in a device node being created. + if event.devname != "" + && event.devpath.starts_with(ROOT_BUS_PATH) + && event.subsystem == "block" + { + let watcher = GLOBAL_DEVICE_WATCHER.clone(); + let mut w = watcher.lock().unwrap(); + + let s = sandbox.clone(); + let mut sb = s.lock().unwrap(); + + // Add the device node name to the pci device map. + sb.pci_device_map + .insert(event.devpath.clone(), event.devname.clone()); + + // Notify watchers that are interested in the udev event. + // Close the channel after watcher has been notified. + + let devpath = event.devpath.clone(); + + let empties: Vec<_> = w + .iter() + .filter(|(dev_addr, _)| { + let pci_p = format!("{}/{}", ROOT_BUS_PATH, *dev_addr); + + // blk block device + devpath.starts_with(pci_p.as_str()) || + // scsi block device + { + (*dev_addr).ends_with(SCSI_BLOCK_SUFFIX) && + devpath.contains(*dev_addr) + } + }) + .map(|(k, sender)| { + let devname = event.devname.clone(); + let _ = sender.send(devname); + k.clone() + }) + .collect(); + + for empty in empties { + w.remove(&empty); + } + } else { + let online_path = + format!("{}/{}/online", SYSFS_DIR, &event.devpath); + if online_path.starts_with(SYSFS_MEMORY_ONLINE_PATH) { + // Check memory hotplug and online if possible + match online_device(online_path.as_ref()) { + Ok(_) => (), + Err(e) => error!( + logger, + "failed to online device"; + "device" => &event.devpath, + "error" => format!("{}", e), + ), + } + } + } + } + } + } + } + } + }); +} diff --git a/src/agent/src/version.rs b/src/agent/src/version.rs new file mode 100644 index 0000000000..9c9f6e21c1 --- /dev/null +++ b/src/agent/src/version.rs @@ -0,0 +1,7 @@ +// Copyright (c) 2019 Ant Financial +// +// SPDX-License-Identifier: Apache-2.0 +// + +pub const AGENT_VERSION: &'static str = "1.4.5"; +pub const API_VERSION: &'static str = "0.0.1";