mirror of
https://fuchsia.googlesource.com/third_party/pigweed.googlesource.com/pigweed/pigweed
synced 2024-09-20 05:41:06 +00:00
82db4b1097
- Rework the Client class to share code with the Server class. - Replace BaseClientCall with a call object also derived from the internal::Call used for server calls. - Implement a system for testing RPC client invocations. - Implement the raw RPC client API and codegen. - Reimplement the Nanopb RPC client API and codegen to share code. - Implement Nanopb client & bidirectional streaming. - Add an integration test that calls RPCs on a C++ server from a C++ client. Requires: pigweed-internal:16720 Change-Id: Id3a0fd31bb3b3259fb9386dae617e68b9bfe6985 Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/65745 Reviewed-by: Ewout van Bekkum <ewout@google.com> Commit-Queue: Wyatt Hepler <hepler@google.com>
155 lines
3.5 KiB
Python
155 lines
3.5 KiB
Python
# Copyright 2021 The Pigweed Authors
|
|
#
|
|
# 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
|
|
#
|
|
# https://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.
|
|
|
|
load("//pw_build:pigweed.bzl", "pw_cc_library", "pw_cc_test")
|
|
load("//pw_protobuf_compiler:proto.bzl", "pw_proto_library")
|
|
load("@com_google_protobuf//:protobuf.bzl", "py_proto_library")
|
|
load("@rules_proto//proto:defs.bzl", "proto_library")
|
|
|
|
package(default_visibility = ["//visibility:public"])
|
|
|
|
licenses(["notice"])
|
|
|
|
pw_cc_library(
|
|
name = "pw_transfer",
|
|
srcs = [
|
|
"client_connection.cc",
|
|
"public/pw_transfer/internal/client_connection.h",
|
|
"public/pw_transfer/internal/server_context.h",
|
|
"server_context.cc",
|
|
"transfer.cc",
|
|
],
|
|
hdrs = [
|
|
"public/pw_transfer/handler.h",
|
|
"public/pw_transfer/transfer.h",
|
|
],
|
|
includes = ["public"],
|
|
deps = [
|
|
":common",
|
|
"//pw_assert",
|
|
"//pw_bytes",
|
|
"//pw_containers:intrusive_list",
|
|
"//pw_log",
|
|
"//pw_protobuf",
|
|
"//pw_result",
|
|
"//pw_status",
|
|
"//pw_stream",
|
|
":transfer_pwpb",
|
|
"//pw_rpc:internal_packet_pwpb",
|
|
# "//pw_rpc",
|
|
"//pw_rpc/raw:server_api",
|
|
# "//pw_rpc/raw:test_method_context",
|
|
"//pw_rpc:internal_test_utils",
|
|
],
|
|
)
|
|
|
|
pw_cc_library(
|
|
name = "client",
|
|
srcs = [
|
|
"client.cc",
|
|
"client_context.cc",
|
|
"public/pw_transfer/internal/client_context.h",
|
|
],
|
|
hdrs = [
|
|
"public/pw_transfer/client.h",
|
|
],
|
|
includes = ["public"],
|
|
deps = [
|
|
":common",
|
|
"//pw_assert",
|
|
"//pw_function",
|
|
"//pw_log",
|
|
"//pw_stream",
|
|
"//pw_sync:lock_annotations",
|
|
"//pw_sync:mutex",
|
|
"//pw_work_queue",
|
|
],
|
|
)
|
|
|
|
pw_cc_library(
|
|
name = "common",
|
|
srcs = [
|
|
"chunk.cc",
|
|
"context.cc",
|
|
"pw_transfer_private/chunk.h",
|
|
],
|
|
hdrs = [
|
|
"public/pw_transfer/internal/context.h",
|
|
],
|
|
includes = ["public"],
|
|
deps = [
|
|
"//pw_bytes",
|
|
"//pw_containers:intrusive_list",
|
|
"//pw_protobuf",
|
|
"//pw_result",
|
|
"//pw_status",
|
|
"//pw_varint",
|
|
],
|
|
)
|
|
|
|
pw_cc_test(
|
|
name = "handler_test",
|
|
srcs = ["handler_test.cc"],
|
|
deps = [
|
|
":pw_transfer",
|
|
"//pw_unit_test",
|
|
],
|
|
)
|
|
|
|
pw_cc_test(
|
|
name = "transfer_test",
|
|
srcs = ["transfer_test.cc"],
|
|
deps = [
|
|
":pw_transfer",
|
|
"//pw_rpc/raw:test_method_context",
|
|
"//pw_unit_test",
|
|
],
|
|
)
|
|
|
|
pw_cc_test(
|
|
name = "client_test",
|
|
srcs = ["client_test.cc"],
|
|
deps = [
|
|
":client",
|
|
"//pw_unit_test",
|
|
],
|
|
)
|
|
|
|
cc_binary(
|
|
name = "test_rpc_server",
|
|
srcs = ["test_rpc_server.cc"],
|
|
deps = [
|
|
":pw_transfer",
|
|
"//pw_log",
|
|
"//pw_rpc/system_server",
|
|
],
|
|
)
|
|
|
|
proto_library(
|
|
name = "transfer_proto",
|
|
srcs = [
|
|
"transfer.proto",
|
|
],
|
|
)
|
|
|
|
pw_proto_library(
|
|
name = "transfer_pwpb",
|
|
deps = [":transfer_proto"],
|
|
)
|
|
|
|
py_proto_library(
|
|
name = "transfer_proto_pb2",
|
|
srcs = ["transfer.proto"],
|
|
)
|