Compare commits

...

33 Commits

Author SHA1 Message Date
Hannah Shi 52d0c6c326
Merge release 1.73.x to main (#336)
* remove cronet files

* remove cronet files

* Sync c-core 1.72.0-pre1

* use c++17 for swift package

* update ios deployment target to 15.0

* Sync c-core 1.72.0

* Sync c-core 1.73.0-pre1

* include additional files

* Re-sync c-core 1.73.0-pre1

* exclude inc files from swift package

* upgrade abseil swift to 0.20250127.1 (#330)

* Sync c-core 1.73.0-pre2

* Sync c-core 1.73.0

* Sync c-core 1.73.1
2025-07-12 16:19:13 -07:00
Hannah Shi d88573fd5f
Merge from 1.73.x (#329)
* remove cronet files

* remove cronet files

* Sync c-core 1.72.0-pre1

* use c++17 for swift package

* update ios deployment target to 15.0

* Sync c-core 1.72.0

* Sync c-core 1.73.0-pre1

* include additional files

* Re-sync c-core 1.73.0-pre1

* exclude inc files from swift package
2025-05-24 11:39:33 -07:00
Hannah Shi e584a88115 Re-sync c-core 1.73.0-pre1 2025-05-24 09:40:48 -07:00
Hannah Shi 96ddc18603 include additional files 2025-05-24 09:40:48 -07:00
Hannah Shi fcb8b99697 Sync c-core 1.73.0-pre1 2025-05-24 09:40:48 -07:00
Hannah Shi 9849f527f0 Sync c-core 1.72.0 2025-05-24 09:40:48 -07:00
Hannah Shi 30bd3c9d49 Sync c-core 1.72.0-pre1 2025-05-24 09:40:48 -07:00
Hannah Shi 78593d170e update ios deployment target to 15.0 2025-04-24 18:00:28 -07:00
Hannah Shi c92e41c10b use c++17 for swift package 2025-04-23 13:32:00 -07:00
Hannah Shi b641ac3789 remove cronet files 2025-04-09 15:51:16 -07:00
Hannah Shi 5c9cda2cf6 remove cronet files 2025-04-09 15:51:16 -07:00
Hannah Shi 6797fe4c02 update github workflow to use macos-14 2025-04-09 14:34:57 -07:00
dennycd 263faa1c99 Native source sync at revision @474418c 2025-04-09 10:40:34 -07:00
Hannah Shi 474418cd86 bump ios.deployment_target to 12.0 for C++17 2025-02-18 17:33:28 -08:00
Hannah Shi 14c4d3795c add setting c++17 to sample podfile 2025-02-18 17:33:28 -08:00
Hannah Shi 76d3d2f8d7
dont skip pod push lint (#310) 2025-02-13 14:51:03 -08:00
dennycd 53fa90a969 Native source sync at revision @32c56c6 2025-01-07 19:22:30 -08:00
dennycd 32c56c60fc Native source sync at revision @c7cb8a8 2024-12-27 18:27:49 -08:00
dennycd c7cb8a8a05 Native source sync at revision @2453c26 2024-12-19 17:20:03 -08:00
Hannah Shi 2453c26211 add address_sorting when extracting grpc files 2024-12-17 20:13:47 -08:00
Hannah Shi b69ba65eac add address_sorting/include to header search path 2024-12-17 20:13:47 -08:00
dennycd 1a8feab3fb Native source sync at revision @a108b20 2024-12-10 21:18:49 -08:00
Hannah Shi a108b20993 bump ios version for gRPCSample 2024-12-09 20:13:04 -08:00
Hannah Shi dfd58160de bump abseil-cpp-SwiftPM to 0.20240116.1 2024-12-09 19:39:00 -08:00
Hannah Shi bc0d47377a use venv when syncing grpc sources 2024-12-04 14:28:29 -08:00
Hannah Shi a583a741a8 Create manual-push-a-pod.yml 2024-11-16 11:37:51 -08:00
Hannah Shi 5f768c6c2e use pip to install pyyaml 2024-10-12 19:47:59 -07:00
dennycd ad9f5fd929 Native source sync at revision @6ae523d 2024-10-08 17:30:50 -07:00
dennycd 6ae523d87a Native source sync at revision @a527461 2024-09-18 08:03:10 -07:00
dennycd a5274614c4 Native source sync at revision @66e013d 2024-08-29 19:36:57 -07:00
Hannah Shi 66e013d603 re-sync c-core 2024-07-30 08:18:41 -07:00
Hannah Shi 585d634f4a add additional upb libs to dependencies 2024-07-30 08:18:41 -07:00
dennycd bb29a1f5b9 Native source sync at revision @cf716d7 2024-07-29 22:52:07 -07:00
2249 changed files with 120128 additions and 79008 deletions

View File

@ -15,7 +15,9 @@ jobs:
run: scripts/prepare_env.sh
- name: Shallow source source
run: scripts/sync_grpc_src_shallow.sh
run: |
source .venv/bin/activate
scripts/sync_grpc_src_shallow.sh
- name: Collect revision hash
run: |

42
.github/workflows/manual-push-a-pod.yml vendored Normal file
View File

@ -0,0 +1,42 @@
# This is a basic workflow that is manually triggered
name: Manual push a pod
# Controls when the action will run. Workflow runs when manually triggered using the UI
# or API.
on:
workflow_dispatch:
inputs:
tag:
description: 'Release tag'
default: ''
required: true
type: string
pod:
description: 'Pod name without .podspec'
default: 'gRPC'
required: true
type: string
env:
COCOAPODS_TRUNK_TOKEN: ${{ secrets.COCOAPODS_TRUNK_TOKEN }}
TAG: ${{ inputs.tag }}
jobs:
release-cocoapod:
runs-on: macos-14
steps:
- name: Repo checkout
uses: actions/checkout@v3
with:
ref: refs/tags/${{ inputs.tag }}
- name: Prepare environment
run: scripts/prepare_env.sh
- name: Pod release
run: scripts/release_cocoapod.sh ${{ inputs.pod }}.podspec
- name: Wait for pod avaialble
run: |
version=${TAG#v}
timeout 1h scripts/wait_for_pod_release.sh ${{ inputs.pod }} $version

View File

@ -24,7 +24,7 @@ let package = Package(
],
dependencies: [
.package(url: "https://github.com/firebase/abseil-cpp-SwiftPM.git", "0.20240116.1"..<"0.20240117.0"),
.package(url: "https://github.com/firebase/abseil-cpp-SwiftPM.git", "0.20250127.0"..<"0.20250128.0"),
.package(url: "https://github.com/firebase/boringssl-SwiftPM.git", "0.32.0"..<"0.33.0"),
],
@ -41,14 +41,13 @@ let package = Package(
"src/cpp/",
"third_party/upb/upb/port/def.inc",
"third_party/upb/upb/port/undef.inc",
"third_party/utf8_range/utf8_range_sse.inc",
"third_party/utf8_range/utf8_range_neon.inc",
"third_party/re2/LICENSE",
"third_party/utf8_range/LICENSE",
"third_party/xxhash/LICENSE",
"third_party/zlib/LICENSE",
"tests",
"include/grpc/grpc_cronet.h",
"src/core/ext/transport/cronet/",
"third_party/objective_c/Cronet/bidirectional_stream_c.h",
],
sources: [
@ -66,6 +65,7 @@ let package = Package(
.headerSearchPath("third_party/upb/"),
.headerSearchPath("third_party/utf8_range/"),
.headerSearchPath("third_party/xxhash/"),
.headerSearchPath("third_party/address_sorting/include/"),
.headerSearchPath("src/core/ext/upb-gen/"),
.headerSearchPath("src/core/ext/upbdefs-gen/"),
.define("GRPC_ARES", to: "0"),
@ -84,8 +84,8 @@ let package = Package(
path: basePath,
exclude: [
"tests",
"include/grpcpp/security/cronet_credentials.h",
"src/cpp/client/cronet_credentials.cc",
"include/grpcpp/ports_undef.inc",
"include/grpcpp/ports_def.inc",
],
sources: [
"src/cpp/",
@ -110,5 +110,5 @@ let package = Package(
),
],
cLanguageStandard: .gnu11,
cxxLanguageStandard: .cxx14
cxxLanguageStandard: .cxx17
)

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -21,7 +21,7 @@
Pod::Spec.new do |s|
s.name = 'gRPC-ProtoRPC'
version = '1.66.0-dev'
version = '1.73.1'
s.version = version
s.summary = 'RPC library for Protocol Buffers, based on gRPC'
s.homepage = 'https://grpc.io'
@ -33,9 +33,9 @@ Pod::Spec.new do |s|
:tag => "v#{version}",
}
s.ios.deployment_target = '10.0'
s.osx.deployment_target = '10.12'
s.tvos.deployment_target = '12.0'
s.ios.deployment_target = '15.0'
s.osx.deployment_target = '11.0'
s.tvos.deployment_target = '13.0'
s.watchos.deployment_target = '6.0'
s.visionos.deployment_target = '1.0'
@ -55,7 +55,7 @@ Pod::Spec.new do |s|
ss.header_mappings_dir = "src/objective-c/ProtoRPC"
ss.dependency "#{s.name}/Legacy-Header", version
ss.dependency 'gRPC/Interface', version
ss.dependency 'Protobuf', '~> 3.0'
ss.dependency 'Protobuf', '~> 4.0'
ss.source_files = "src/objective-c/ProtoRPC/ProtoMethod.{h,m}",
"src/objective-c/ProtoRPC/ProtoRPC.{h,m}",
@ -68,7 +68,7 @@ Pod::Spec.new do |s|
ss.dependency "#{s.name}/Legacy-Header", version
ss.dependency 'gRPC/GRPCCore', version
ss.dependency 'gRPC-RxLibrary', version
ss.dependency 'Protobuf', '~> 3.0'
ss.dependency 'Protobuf', '~> 4.0'
ss.source_files = "src/objective-c/ProtoRPC/ProtoRPCLegacy.m",
"src/objective-c/ProtoRPC/ProtoServiceLegacy.m"
@ -85,6 +85,6 @@ Pod::Spec.new do |s|
# This is needed by all pods that depend on gRPC-RxLibrary:
'CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES' => 'YES',
'CLANG_WARN_STRICT_PROTOTYPES' => 'NO',
'CLANG_CXX_LANGUAGE_STANDARD' => 'c++14',
'CLANG_CXX_LANGUAGE_STANDARD' => 'c++17',
}
end

View File

@ -21,7 +21,7 @@
Pod::Spec.new do |s|
s.name = 'gRPC-RxLibrary'
version = '1.66.0-dev'
version = '1.73.1'
s.version = version
s.summary = 'Reactive Extensions library for iOS/OSX.'
s.homepage = 'https://grpc.io'
@ -33,9 +33,9 @@ Pod::Spec.new do |s|
:tag => "v#{version}",
}
s.ios.deployment_target = '10.0'
s.osx.deployment_target = '10.12'
s.tvos.deployment_target = '12.0'
s.ios.deployment_target = '15.0'
s.osx.deployment_target = '11.0'
s.tvos.deployment_target = '13.0'
s.watchos.deployment_target = '6.0'
s.visionos.deployment_target = '1.0'
@ -67,6 +67,6 @@ Pod::Spec.new do |s|
s.pod_target_xcconfig = {
'CLANG_WARN_STRICT_PROTOTYPES' => 'NO',
'CLANG_CXX_LANGUAGE_STANDARD' => 'c++14',
'CLANG_CXX_LANGUAGE_STANDARD' => 'c++17',
}
end

View File

@ -20,7 +20,7 @@
Pod::Spec.new do |s|
s.name = 'gRPC'
version = '1.66.0-dev'
version = '1.73.1'
s.version = version
s.summary = 'gRPC client library for iOS/OSX'
s.homepage = 'https://grpc.io'
@ -42,12 +42,12 @@ Pod::Spec.new do |s|
# This is needed by all pods that depend on gRPC-RxLibrary:
'CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES' => 'YES',
'CLANG_WARN_STRICT_PROTOTYPES' => 'NO',
'CLANG_CXX_LANGUAGE_STANDARD' => 'c++14',
'CLANG_CXX_LANGUAGE_STANDARD' => 'c++17',
}
s.ios.deployment_target = '10.0'
s.osx.deployment_target = '10.12'
s.tvos.deployment_target = '12.0'
s.ios.deployment_target = '15.0'
s.osx.deployment_target = '11.0'
s.tvos.deployment_target = '13.0'
s.watchos.deployment_target = '6.0'
s.visionos.deployment_target = '1.0'
@ -64,7 +64,6 @@ Pod::Spec.new do |s|
ss.public_header_files = "src/objective-c/GRPCClient/GRPCCall+ChannelArg.h",
"src/objective-c/GRPCClient/GRPCCall+ChannelCredentials.h",
"src/objective-c/GRPCClient/GRPCCall+Cronet.h",
"src/objective-c/GRPCClient/GRPCCall+OAuth2.h",
"src/objective-c/GRPCClient/GRPCCall+Tests.h",
"src/objective-c/GRPCClient/GRPCCallLegacy.h",
@ -72,7 +71,6 @@ Pod::Spec.new do |s|
ss.source_files = "src/objective-c/GRPCClient/GRPCCall+ChannelArg.h",
"src/objective-c/GRPCClient/GRPCCall+ChannelCredentials.h",
"src/objective-c/GRPCClient/GRPCCall+Cronet.h",
"src/objective-c/GRPCClient/GRPCCall+OAuth2.h",
"src/objective-c/GRPCClient/GRPCCall+Tests.h",
"src/objective-c/GRPCClient/GRPCCallLegacy.h",
@ -80,9 +78,9 @@ Pod::Spec.new do |s|
"src/objective-c/GRPCClient/GRPCTypes.mm"
ss.dependency "gRPC-RxLibrary/Interface", version
ss.dependency "#{s.name}/Privacy", version
s.ios.deployment_target = '10.0'
s.osx.deployment_target = '10.12'
s.tvos.deployment_target = '12.0'
s.ios.deployment_target = '15.0'
s.osx.deployment_target = '11.0'
s.tvos.deployment_target = '13.0'
s.watchos.deployment_target = '6.0'
s.visionos.deployment_target = '1.0'
end
@ -116,9 +114,9 @@ Pod::Spec.new do |s|
ss.dependency "#{s.name}/Interface-Legacy", version
ss.dependency "#{s.name}/Privacy", version
s.ios.deployment_target = '10.0'
s.osx.deployment_target = '10.12'
s.tvos.deployment_target = '12.0'
s.ios.deployment_target = '15.0'
s.osx.deployment_target = '11.0'
s.tvos.deployment_target = '13.0'
s.watchos.deployment_target = '6.0'
s.visionos.deployment_target = '1.0'
end
@ -127,7 +125,6 @@ Pod::Spec.new do |s|
ss.header_mappings_dir = 'src/objective-c/GRPCClient'
ss.public_header_files = 'src/objective-c/GRPCClient/GRPCCall+ChannelCredentials.h',
'src/objective-c/GRPCClient/GRPCCall+Cronet.h',
'src/objective-c/GRPCClient/GRPCCall+OAuth2.h',
'src/objective-c/GRPCClient/GRPCCall+Tests.h',
'src/objective-c/GRPCClient/GRPCCall+ChannelArg.h'
@ -137,8 +134,6 @@ Pod::Spec.new do |s|
'src/objective-c/GRPCClient/GRPCCall+ChannelArg.mm',
'src/objective-c/GRPCClient/GRPCCall+ChannelCredentials.h',
'src/objective-c/GRPCClient/GRPCCall+ChannelCredentials.mm',
'src/objective-c/GRPCClient/GRPCCall+Cronet.h',
'src/objective-c/GRPCClient/GRPCCall+Cronet.mm',
'src/objective-c/GRPCClient/GRPCCall+OAuth2.h',
'src/objective-c/GRPCClient/GRPCCall+OAuth2.mm',
'src/objective-c/GRPCClient/GRPCCall+Tests.h',
@ -154,34 +149,20 @@ Pod::Spec.new do |s|
ss.dependency 'gRPC-Core', version
ss.dependency 'gRPC-RxLibrary', version
s.ios.deployment_target = '10.0'
s.osx.deployment_target = '10.12'
s.tvos.deployment_target = '12.0'
s.ios.deployment_target = '15.0'
s.osx.deployment_target = '11.0'
s.tvos.deployment_target = '13.0'
s.watchos.deployment_target = '6.0'
s.visionos.deployment_target = '1.0'
end
s.subspec 'GRPCCoreCronet' do |ss|
ss.header_mappings_dir = 'src/objective-c/GRPCClient'
ss.source_files = 'src/objective-c/GRPCClient/GRPCCall+Cronet.h',
'src/objective-c/GRPCClient/GRPCCall+Cronet.mm',
'src/objective-c/GRPCClient/private/GRPCCore/GRPCCoreCronet/*.{h,mm}'
ss.dependency "#{s.name}/GRPCCore", version
ss.dependency "#{s.name}/Privacy", version
ss.dependency 'gRPC-Core/Cronet-Implementation', version
ss.dependency 'CronetFramework'
ss.ios.deployment_target = '10.0'
end
# CFStream is now default. Leaving this subspec only for compatibility purpose.
s.subspec 'CFStream' do |ss|
ss.dependency "#{s.name}/GRPCCore", version
s.ios.deployment_target = '10.0'
s.osx.deployment_target = '10.12'
s.tvos.deployment_target = '12.0'
s.ios.deployment_target = '15.0'
s.osx.deployment_target = '11.0'
s.tvos.deployment_target = '13.0'
s.watchos.deployment_target = '6.0'
s.visionos.deployment_target = '1.0'
end
@ -192,9 +173,9 @@ Pod::Spec.new do |s|
ss.source_files = 'src/objective-c/GRPCClient/internal_testing/*.{h,mm}'
ss.header_mappings_dir = 'src/objective-c/GRPCClient'
s.ios.deployment_target = '10.0'
s.osx.deployment_target = '10.12'
s.tvos.deployment_target = '12.0'
s.ios.deployment_target = '15.0'
s.osx.deployment_target = '11.0'
s.tvos.deployment_target = '13.0'
s.watchos.deployment_target = '6.0'
s.visionos.deployment_target = '1.0'
end

View File

@ -19,11 +19,10 @@
#ifndef GRPC_COMPRESSION_H
#define GRPC_COMPRESSION_H
#include <stdlib.h>
#include <grpc/impl/compression_types.h> // IWYU pragma: export
#include <grpc/slice.h>
#include <grpc/support/port_platform.h>
#include <stdlib.h>
#ifdef __cplusplus
extern "C" {

View File

@ -19,11 +19,10 @@
#ifndef GRPC_CREDENTIALS_H
#define GRPC_CREDENTIALS_H
#include <stdbool.h>
#include <grpc/grpc.h>
#include <grpc/grpc_security_constants.h>
#include <grpc/support/port_platform.h>
#include <stdbool.h>
#ifdef __cplusplus
extern "C" {
@ -103,7 +102,7 @@ GRPCAPI grpc_call_credentials* grpc_sts_credentials_create(
/** Context that can be used by metadata credentials plugin in order to create
auth related metadata. */
typedef struct {
/** The fully qualifed service url. */
/** The fully qualified service url. */
const char* service_url;
/** The method name of the RPC being called (not fully qualified).

View File

@ -14,12 +14,12 @@
#ifndef GRPC_EVENT_ENGINE_ENDPOINT_CONFIG_H
#define GRPC_EVENT_ENGINE_ENDPOINT_CONFIG_H
#include <grpc/support/port_platform.h>
#include <optional>
#include <string>
#include "absl/strings/string_view.h"
#include "absl/types/optional.h"
#include <grpc/support/port_platform.h>
namespace grpc_event_engine {
namespace experimental {
@ -32,11 +32,11 @@ class EndpointConfig {
public:
virtual ~EndpointConfig() = default;
// If the key points to an integer config, an integer value gets returned.
// Otherwise it returns an absl::nullopt_t
virtual absl::optional<int> GetInt(absl::string_view key) const = 0;
// Otherwise it returns an std::nullopt_t
virtual std::optional<int> GetInt(absl::string_view key) const = 0;
// If the key points to an string config, an string value gets returned.
// Otherwise it returns an absl::nullopt_t
virtual absl::optional<absl::string_view> GetString(
// Otherwise it returns an std::nullopt_t
virtual std::optional<absl::string_view> GetString(
absl::string_view key) const = 0;
// If the key points to an void* config, a void* pointer value gets returned.
// Otherwise it returns nullptr

View File

@ -14,20 +14,24 @@
#ifndef GRPC_EVENT_ENGINE_EVENT_ENGINE_H
#define GRPC_EVENT_ENGINE_EVENT_ENGINE_H
#include <grpc/event_engine/endpoint_config.h>
#include <grpc/event_engine/extensible.h>
#include <grpc/event_engine/internal/write_event.h>
#include <grpc/event_engine/memory_allocator.h>
#include <grpc/event_engine/port.h>
#include <grpc/event_engine/slice_buffer.h>
#include <grpc/support/port_platform.h>
#include <bitset>
#include <initializer_list>
#include <vector>
#include "absl/functional/any_invocable.h"
#include "absl/status/status.h"
#include "absl/status/statusor.h"
#include <grpc/event_engine/endpoint_config.h>
#include <grpc/event_engine/extensible.h>
#include <grpc/event_engine/memory_allocator.h>
#include <grpc/event_engine/port.h>
#include <grpc/event_engine/slice_buffer.h>
#include <grpc/support/port_platform.h>
// TODO(vigneshbabu): Define the Endpoint::Write metrics collection system
// TODO(hork): remove all references to the factory methods.
namespace grpc_event_engine {
namespace experimental {
@ -179,13 +183,26 @@ class EventEngine : public std::enable_shared_from_this<EventEngine>,
/// EventEngine Endpoint Read API call.
///
/// Passed as argument to an Endpoint \a Read
struct ReadArgs {
class ReadArgs final {
public:
ReadArgs() = default;
ReadArgs(const ReadArgs&) = delete;
ReadArgs& operator=(const ReadArgs&) = delete;
ReadArgs(ReadArgs&&) = default;
ReadArgs& operator=(ReadArgs&&) = default;
// A suggestion to the endpoint implementation to read at-least the
// specified number of bytes over the network connection before marking
// the endpoint read operation as complete. gRPC may use this argument
// to minimize the number of endpoint read API calls over the lifetime
// of a connection.
int64_t read_hint_bytes;
void set_read_hint_bytes(int64_t read_hint_bytes) {
read_hint_bytes_ = read_hint_bytes;
}
int64_t read_hint_bytes() const { return read_hint_bytes_; }
private:
int64_t read_hint_bytes_ = 1;
};
/// Reads data from the Endpoint.
///
@ -194,9 +211,12 @@ class EventEngine : public std::enable_shared_from_this<EventEngine>,
/// on_read callback is not executed. Otherwise it returns false and the \a
/// on_read callback executes asynchronously when the read completes. The
/// caller must ensure that the callback has access to the buffer when it
/// executes. Ownership of the buffer is not transferred. Valid slices *may*
/// be placed into the buffer even if the callback is invoked with a non-OK
/// Status.
/// executes. Ownership of the buffer is not transferred. Either an error is
/// passed to the callback (like socket closed), or valid data is available
/// in the buffer, but never both at the same time. Implementations that
/// receive valid data must not throw that data away - that is, if valid
/// data is received on the underlying endpoint, a callback will be made
/// with that data available and an ok status.
///
/// There can be at most one outstanding read per Endpoint at any given
/// time. An outstanding read is one in which the \a on_read callback has
@ -208,20 +228,110 @@ class EventEngine : public std::enable_shared_from_this<EventEngine>,
/// statuses to \a on_read. For example, callbacks might expect to receive
/// CANCELLED on endpoint shutdown.
virtual bool Read(absl::AnyInvocable<void(absl::Status)> on_read,
SliceBuffer* buffer, const ReadArgs* args) = 0;
SliceBuffer* buffer, ReadArgs args) = 0;
//// The set of write events that can be reported by an Endpoint.
using WriteEvent = ::grpc_event_engine::experimental::internal::WriteEvent;
/// An output WriteMetric consists of a key and a value.
/// The space of keys can be queried from the endpoint via the
/// \a AllWriteMetrics, \a GetMetricName and \a GetMetricKey APIs.
/// The value is an int64_t that is implementation-defined. Check with the
/// endpoint implementation documentation for the semantics of each metric.
struct WriteMetric {
size_t key;
int64_t value;
};
using WriteEventCallback = absl::AnyInvocable<void(
WriteEvent, absl::Time, std::vector<WriteMetric>) const>;
// A bitmask of the events that the caller is interested in.
// Each bit corresponds to an entry in WriteEvent.
using WriteEventSet = std::bitset<static_cast<int>(WriteEvent::kCount)>;
// A sink to receive write events.
// The requested metrics are the keys of the metrics that the caller is
// interested in. The on_event callback will be called on each event
// requested.
class WriteEventSink final {
public:
WriteEventSink(absl::Span<const size_t> requested_metrics,
std::initializer_list<WriteEvent> requested_events,
WriteEventCallback on_event)
: requested_metrics_(requested_metrics),
on_event_(std::move(on_event)) {
for (auto event : requested_events) {
requested_events_mask_.set(static_cast<int>(event));
}
}
absl::Span<const size_t> requested_metrics() const {
return requested_metrics_;
}
bool requested_event(WriteEvent event) const {
return requested_events_mask_.test(static_cast<int>(event));
}
WriteEventSet requested_events_mask() const {
return requested_events_mask_;
}
WriteEventCallback TakeEventCallback() { return std::move(on_event_); }
private:
absl::Span<const size_t> requested_metrics_;
WriteEventSet requested_events_mask_;
// The callback to be called on each event.
WriteEventCallback on_event_;
};
/// A struct representing optional arguments that may be provided to an
/// EventEngine Endpoint Write API call.
///
/// Passed as argument to an Endpoint \a Write
struct WriteArgs {
class WriteArgs final {
public:
WriteArgs() = default;
WriteArgs(const WriteArgs&) = delete;
WriteArgs& operator=(const WriteArgs&) = delete;
WriteArgs(WriteArgs&&) = default;
WriteArgs& operator=(WriteArgs&&) = default;
// A sink to receive write events.
std::optional<WriteEventSink> TakeMetricsSink() {
auto sink = std::move(metrics_sink_);
metrics_sink_.reset();
return sink;
}
bool has_metrics_sink() const { return metrics_sink_.has_value(); }
void set_metrics_sink(WriteEventSink sink) {
metrics_sink_ = std::move(sink);
}
// Represents private information that may be passed by gRPC for
// select endpoints expected to be used only within google.
void* google_specific = nullptr;
// TODO(ctiller): Remove this method once all callers are migrated to
// metrics sink.
void* GetDeprecatedAndDiscouragedGoogleSpecificPointer() {
return google_specific_;
}
void SetDeprecatedAndDiscouragedGoogleSpecificPointer(void* pointer) {
google_specific_ = pointer;
}
// A suggestion to the endpoint implementation to group data to be written
// into frames of the specified max_frame_size. gRPC may use this
// argument to dynamically control the max sizes of frames sent to a
// receiver in response to high receiver memory pressure.
int64_t max_frame_size;
int64_t max_frame_size() const { return max_frame_size_; }
void set_max_frame_size(int64_t max_frame_size) {
max_frame_size_ = max_frame_size;
}
private:
std::optional<WriteEventSink> metrics_sink_;
void* google_specific_ = nullptr;
int64_t max_frame_size_ = 1024 * 1024;
};
/// Writes data out on the connection.
///
@ -244,11 +354,22 @@ class EventEngine : public std::enable_shared_from_this<EventEngine>,
/// statuses to \a on_writable. For example, callbacks might expect to
/// receive CANCELLED on endpoint shutdown.
virtual bool Write(absl::AnyInvocable<void(absl::Status)> on_writable,
SliceBuffer* data, const WriteArgs* args) = 0;
SliceBuffer* data, WriteArgs args) = 0;
/// Returns an address in the format described in DNSResolver. The returned
/// values are expected to remain valid for the life of the Endpoint.
virtual const ResolvedAddress& GetPeerAddress() const = 0;
virtual const ResolvedAddress& GetLocalAddress() const = 0;
/// Returns the list of write metrics that the endpoint supports.
/// The keys are used to identify the metrics in the GetMetricName and
/// GetMetricKey APIs. The current value of the metric can be queried by
/// adding a WriteEventSink to the WriteArgs of a Write call.
virtual std::vector<size_t> AllWriteMetrics() = 0;
/// Returns the name of the write metric with the given key.
/// If the key is not found, returns std::nullopt.
virtual std::optional<absl::string_view> GetMetricName(size_t key) = 0;
/// Returns the key of the write metric with the given name.
/// If the name is not found, returns std::nullopt.
virtual std::optional<size_t> GetMetricKey(absl::string_view name) = 0;
};
/// Called when a new connection is established.
@ -330,7 +451,7 @@ class EventEngine : public std::enable_shared_from_this<EventEngine>,
/// when the object is destroyed and all pending callbacks will be called
/// shortly. If cancellation races with request completion, implementations
/// may choose to either cancel or satisfy the request.
class DNSResolver {
class DNSResolver : public Extensible {
public:
/// Optional configuration for DNSResolvers.
struct ResolverOptions {
@ -468,7 +589,7 @@ class EventEngine : public std::enable_shared_from_this<EventEngine>,
virtual bool Cancel(TaskHandle handle) = 0;
};
/// Replace gRPC's default EventEngine factory.
/// [DEPRECATED] Replace gRPC's default EventEngine factory.
///
/// Applications may call \a SetEventEngineFactory at any time to replace the
/// default factory used within gRPC. EventEngines will be created when
@ -477,18 +598,56 @@ class EventEngine : public std::enable_shared_from_this<EventEngine>,
/// To be certain that none of the gRPC-provided built-in EventEngines are
/// created, applications must set a custom EventEngine factory method *before*
/// grpc is initialized.
// TODO(hork): delete once all known users have migrated away
void SetEventEngineFactory(
absl::AnyInvocable<std::unique_ptr<EventEngine>()> factory);
absl::AnyInvocable<std::shared_ptr<EventEngine>()> factory);
/// Reset gRPC's EventEngine factory to the built-in default.
/// [DEPRECATED] Reset gRPC's EventEngine factory to the built-in default.
///
/// Applications that have called \a SetEventEngineFactory can remove their
/// custom factory using this method. The built-in EventEngine factories will be
/// used going forward. This has no affect on any EventEngines that were created
/// using the previous factories.
//
// TODO(hork): delete once all known users have migrated away
void EventEngineFactoryReset();
/// Create an EventEngine using the default factory.
std::unique_ptr<EventEngine> CreateEventEngine();
/// Create a new EventEngine instance.
std::shared_ptr<EventEngine> CreateEventEngine();
/// Set the default EventEngine instance, which will be used throughout gRPC
///
/// gRPC will hold a ref to this engine until either
/// \a ShutdownDefaultEventEngine() is called or \a SetDefaultEventEngine() is
/// called again with a different value. Passing a value of nullptr will cause
/// gRPC to drop the ref it was holding without setting it to a new one.
///
/// Earlier calls to \a GetDefaultEventEngine will still hold a ref to the
/// previous default engine instance, if any.
void SetDefaultEventEngine(std::shared_ptr<EventEngine> engine);
/// Returns the default EventEngine instance.
///
/// Note that if SetDefaultEventEngine() has not been called, then the default
/// EventEngine may be created and destroyed as needed, meaning that multiple
/// calls to GetDefaultEventEngine() over a process's lifetime may return
/// different instances. Callers are expected to call GetDefaultEventEngine()
/// once and hold the returned reference for as long as they need the
/// EventEngine instance.
std::shared_ptr<EventEngine> GetDefaultEventEngine();
/// Resets gRPC to use one of the default internal EventEngines for all *new*
/// \a GetDefaultEventEngine requests and blocks until all refs on the active
/// default engine have been released (destroying that engine).
///
/// If you called \a SetDefaultEventEngine, you must call either
/// \a ShutdownDefaultEventEngine or \a SetDefaultEventEngine(nullptr) at the
/// end of your program. If you don't, the engine will never be destroyed.
///
/// If you want to reset the default engine to one of gRPC's internal versions
/// without waiting for all references to be released on the current default
/// engine, call \a SetDefaultEventEngine(nullptr) instead.
void ShutdownDefaultEventEngine();
bool operator==(const EventEngine::TaskHandle& lhs,
const EventEngine::TaskHandle& rhs);
@ -503,6 +662,20 @@ bool operator!=(const EventEngine::ConnectionHandle& lhs,
std::ostream& operator<<(std::ostream& out,
const EventEngine::ConnectionHandle& handle);
namespace detail {
std::string FormatHandleString(uint64_t key1, uint64_t key2);
}
template <typename Sink>
void AbslStringify(Sink& out, const EventEngine::ConnectionHandle& handle) {
out.Append(detail::FormatHandleString(handle.keys[0], handle.keys[1]));
}
template <typename Sink>
void AbslStringify(Sink& out, const EventEngine::TaskHandle& handle) {
out.Append(detail::FormatHandleString(handle.keys[0], handle.keys[1]));
}
} // namespace experimental
} // namespace grpc_event_engine

View File

@ -15,10 +15,10 @@
#ifndef GRPC_EVENT_ENGINE_EXTENSIBLE_H
#define GRPC_EVENT_ENGINE_EXTENSIBLE_H
#include "absl/strings/string_view.h"
#include <grpc/support/port_platform.h>
#include "absl/strings/string_view.h"
namespace grpc_event_engine {
namespace experimental {
@ -60,6 +60,9 @@ class Extensible {
/// if (endpoint != nullptr) endpoint->Process();
///
virtual void* QueryExtension(absl::string_view /*id*/) { return nullptr; }
protected:
~Extensible() = default;
};
} // namespace experimental

View File

@ -14,15 +14,15 @@
#ifndef GRPC_EVENT_ENGINE_INTERNAL_MEMORY_ALLOCATOR_IMPL_H
#define GRPC_EVENT_ENGINE_INTERNAL_MEMORY_ALLOCATOR_IMPL_H
#include <grpc/event_engine/memory_request.h>
#include <grpc/slice.h>
#include <grpc/support/port_platform.h>
#include <algorithm>
#include <memory>
#include <type_traits>
#include <vector>
#include <grpc/event_engine/memory_request.h>
#include <grpc/slice.h>
#include <grpc/support/port_platform.h>
namespace grpc_event_engine {
namespace experimental {

View File

@ -24,7 +24,7 @@ namespace internal {
// with `SliceCast`. Both ways need to be declared (i.e. if
// SliceCastable<A,B> exists, you should declare
// SliceCastable<B,A> too).
// The type has no members, it's just the existance of the specialization that
// The type has no members, it's just the existence of the specialization that
// unlocks SliceCast usage for a type pair.
template <typename Result, typename T>
struct SliceCastable;

View File

@ -0,0 +1,34 @@
// Copyright 2022 gRPC 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
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef GRPC_EVENT_ENGINE_INTERNAL_WRITE_EVENT_H
#define GRPC_EVENT_ENGINE_INTERNAL_WRITE_EVENT_H
namespace grpc_event_engine::experimental::internal {
// Use of this enum via this name is internal to gRPC.
// API users should get this enumeration via the
// EventEngine::Endpoint::WriteEvent.
enum class WriteEvent {
kSendMsg,
kScheduled,
kSent,
kAcked,
kClosed,
kCount // Must be last.
};
} // namespace grpc_event_engine::experimental::internal
#endif // GRPC_EVENT_ENGINE_INTERNAL_WRITE_EVENT_H

View File

@ -14,6 +14,9 @@
#ifndef GRPC_EVENT_ENGINE_MEMORY_ALLOCATOR_H
#define GRPC_EVENT_ENGINE_MEMORY_ALLOCATOR_H
#include <grpc/event_engine/internal/memory_allocator_impl.h>
#include <grpc/slice.h>
#include <grpc/support/port_platform.h>
#include <stdlib.h> // for abort()
#include <algorithm>
@ -21,10 +24,6 @@
#include <type_traits>
#include <vector>
#include <grpc/event_engine/internal/memory_allocator_impl.h>
#include <grpc/slice.h>
#include <grpc/support/port_platform.h>
namespace grpc_event_engine {
namespace experimental {

View File

@ -14,12 +14,11 @@
#ifndef GRPC_EVENT_ENGINE_MEMORY_REQUEST_H
#define GRPC_EVENT_ENGINE_MEMORY_REQUEST_H
#include <grpc/support/port_platform.h>
#include <stddef.h>
#include "absl/strings/string_view.h"
#include <grpc/support/port_platform.h>
namespace grpc_event_engine {
namespace experimental {
@ -46,6 +45,24 @@ class MemoryRequest {
size_t min() const { return min_; }
size_t max() const { return max_; }
bool operator==(const MemoryRequest& other) const {
return min_ == other.min_ && max_ == other.max_;
}
bool operator!=(const MemoryRequest& other) const {
return !(*this == other);
}
template <typename Sink>
friend void AbslStringify(Sink& s, const MemoryRequest& r) {
if (r.min_ == r.max_) {
s.Append(std::to_string(r.min_));
} else {
s.Append(std::to_string(r.min_));
s.Append("..");
s.Append(std::to_string(r.max_));
}
}
private:
size_t min_;
size_t max_;

View File

@ -15,6 +15,9 @@
#ifndef GRPC_EVENT_ENGINE_SLICE_H
#define GRPC_EVENT_ENGINE_SLICE_H
#include <grpc/event_engine/internal/slice_cast.h>
#include <grpc/slice.h>
#include <grpc/support/port_platform.h>
#include <string.h>
#include <cstdint>
@ -23,11 +26,6 @@
#include "absl/strings/string_view.h"
#include <grpc/event_engine/internal/slice_cast.h>
#include <grpc/slice.h>
#include <grpc/support/log.h>
#include <grpc/support/port_platform.h>
// This public slice definition largely based of the internal grpc_core::Slice
// implementation. Changes to this implementation might warrant changes to the
// internal grpc_core::Slice type as well.

View File

@ -15,6 +15,12 @@
#ifndef GRPC_EVENT_ENGINE_SLICE_BUFFER_H
#define GRPC_EVENT_ENGINE_SLICE_BUFFER_H
#include <grpc/event_engine/internal/slice_cast.h>
#include <grpc/event_engine/slice.h>
#include <grpc/impl/codegen/slice.h>
#include <grpc/slice.h>
#include <grpc/slice_buffer.h>
#include <grpc/support/port_platform.h>
#include <string.h>
#include <cstdint>
@ -23,14 +29,6 @@
#include "absl/strings/string_view.h"
#include "absl/utility/utility.h"
#include <grpc/event_engine/internal/slice_cast.h>
#include <grpc/event_engine/slice.h>
#include <grpc/impl/codegen/slice.h>
#include <grpc/slice.h>
#include <grpc/slice_buffer.h>
#include <grpc/support/log.h>
#include <grpc/support/port_platform.h>
namespace grpc_event_engine {
namespace experimental {

View File

@ -19,8 +19,6 @@
#ifndef GRPC_GRPC_H
#define GRPC_GRPC_H
#include <stddef.h>
#include <grpc/byte_buffer.h>
#include <grpc/impl/connectivity_state.h> // IWYU pragma: export
#include <grpc/impl/grpc_types.h> // IWYU pragma: export
@ -29,6 +27,7 @@
#include <grpc/status.h>
#include <grpc/support/port_platform.h>
#include <grpc/support/time.h>
#include <stddef.h>
#ifdef __cplusplus
extern "C" {

View File

@ -19,15 +19,15 @@
#ifndef GRPC_GRPC_AUDIT_LOGGING_H
#define GRPC_GRPC_AUDIT_LOGGING_H
#include <grpc/support/json.h>
#include <grpc/support/port_platform.h>
#include <memory>
#include <string>
#include "absl/status/statusor.h"
#include "absl/strings/string_view.h"
#include <grpc/support/json.h>
#include <grpc/support/port_platform.h>
namespace grpc_core {
namespace experimental {

View File

@ -19,16 +19,16 @@
#ifndef GRPC_GRPC_CRL_PROVIDER_H
#define GRPC_GRPC_CRL_PROVIDER_H
#include <grpc/credentials.h>
#include <grpc/grpc_security.h>
#include <grpc/support/port_platform.h>
#include <memory>
#include <string>
#include "absl/status/statusor.h"
#include "absl/strings/string_view.h"
#include <grpc/credentials.h>
#include <grpc/grpc_security.h>
#include <grpc/support/port_platform.h>
namespace grpc_core {
namespace experimental {
@ -82,7 +82,7 @@ absl::StatusOr<std::shared_ptr<CrlProvider>> CreateDirectoryReloaderCrlProvider(
} // namespace experimental
} // namespace grpc_core
// TODO(gtcooke94) - Mark with api macro when all wrapped langauges support C++
// TODO(gtcooke94) - Mark with api macro when all wrapped languages support C++
// in core APIs
/**
* EXPERIMENTAL API - Subject to change

View File

@ -1,37 +0,0 @@
/*
*
* Copyright 2016 gRPC 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
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
#ifndef GRPC_GRPC_CRONET_H
#define GRPC_GRPC_CRONET_H
#include <grpc/grpc.h>
#include <grpc/support/port_platform.h>
#ifdef __cplusplus
extern "C" {
#endif
GRPCAPI grpc_channel* grpc_cronet_secure_channel_create(
void* engine, const char* target, const grpc_channel_args* args,
void* reserved);
#ifdef __cplusplus
}
#endif
#endif /* GRPC_GRPC_CRONET_H */

View File

@ -19,11 +19,10 @@
#ifndef GRPC_GRPC_POSIX_H
#define GRPC_GRPC_POSIX_H
#include <stddef.h>
#include <grpc/grpc.h>
#include <grpc/impl/grpc_types.h>
#include <grpc/support/port_platform.h>
#include <stddef.h>
#ifdef __cplusplus
extern "C" {

View File

@ -19,12 +19,11 @@
#ifndef GRPC_GRPC_SECURITY_H
#define GRPC_GRPC_SECURITY_H
#include <stdbool.h>
#include <grpc/grpc.h>
#include <grpc/grpc_security_constants.h>
#include <grpc/status.h>
#include <grpc/support/port_platform.h>
#include <stdbool.h>
#ifdef __cplusplus
extern "C" {

View File

@ -15,11 +15,11 @@
#ifndef GRPC_IMPL_CALL_H
#define GRPC_IMPL_CALL_H
#include "absl/functional/any_invocable.h"
#include <grpc/grpc.h>
#include <grpc/support/port_platform.h>
#include "absl/functional/any_invocable.h"
// Run a callback in the call's EventEngine.
// Internal-only
void grpc_call_run_in_event_engine(const grpc_call* call,

View File

@ -31,13 +31,15 @@
#define GRPC_ARG_SERVER_CALL_METRIC_RECORDING \
"grpc.server_call_metric_recording"
/** Request that optional features default to off (regardless of what they
usually default to) - to enable tight control over what gets enabled */
usually default to) - to enable tight control over what gets enabled
Boolean valued. Defaults to false. */
#define GRPC_ARG_MINIMAL_STACK "grpc.minimal_stack"
/** Maximum number of concurrent incoming streams to allow on a http2
connection. Int valued. */
connection. Int valued. Deafult to -1(indicating no explicit limit).*/
#define GRPC_ARG_MAX_CONCURRENT_STREAMS "grpc.max_concurrent_streams"
/** Maximum message length that the channel can receive. Int valued, bytes.
-1 means unlimited. */
-1 means unlimited. Defaults to 4MB(4*1024*1024 bytes). -1 means unlimited.
*/
#define GRPC_ARG_MAX_RECEIVE_MESSAGE_LENGTH "grpc.max_receive_message_length"
/** \deprecated For backward compatibility.
* Use GRPC_ARG_MAX_RECEIVE_MESSAGE_LENGTH instead. */
@ -47,27 +49,31 @@
#define GRPC_ARG_MAX_SEND_MESSAGE_LENGTH "grpc.max_send_message_length"
/** Maximum time that a channel may have no outstanding rpcs, after which the
* server will close the connection. Int valued, milliseconds. INT_MAX means
* unlimited. */
* unlimited. Defaults to INT_MAX. */
#define GRPC_ARG_MAX_CONNECTION_IDLE_MS "grpc.max_connection_idle_ms"
/** Maximum time that a channel may exist. Int valued, milliseconds.
* INT_MAX means unlimited. */
/** Maximum amount of time in milliseconds that a connection may exist before it
* will be gracefully shut down. Refer
* https://github.com/grpc/proposal/blob/master/A9-server-side-conn-mgt.md for
* more details. Int valued, defaults to INT_MAX (disabled). */
#define GRPC_ARG_MAX_CONNECTION_AGE_MS "grpc.max_connection_age_ms"
/** Grace period after the channel reaches its max age. Int valued,
milliseconds. INT_MAX means unlimited. */
/** Grace period in milliseconds after connection reaches its max age for
* outstanding RPCs to complete. Int valued, defaults to INT_MAX (disabled). */
#define GRPC_ARG_MAX_CONNECTION_AGE_GRACE_MS "grpc.max_connection_age_grace_ms"
/** Timeout after the last RPC finishes on the client channel at which the
* channel goes back into IDLE state. Int valued, milliseconds. INT_MAX means
* unlimited. The default value is 30 minutes and the min value is 1 second. */
#define GRPC_ARG_CLIENT_IDLE_TIMEOUT_MS "grpc.client_idle_timeout_ms"
/** Enable/disable support for per-message compression. Defaults to 1, unless
GRPC_ARG_MINIMAL_STACK is enabled, in which case it defaults to 0. */
/** Enable/disable support for per-message compression. Boolean valued. Defaults
to true, unless GRPC_ARG_MINIMAL_STACK is enabled, in which case it defaults
to false. */
#define GRPC_ARG_ENABLE_PER_MESSAGE_COMPRESSION "grpc.per_message_compression"
/** Experimental Arg. Enable/disable support for per-message decompression.
Defaults to 1. If disabled, decompression will not be performed and the
application will see the compressed message in the byte buffer. */
#define GRPC_ARG_ENABLE_PER_MESSAGE_DECOMPRESSION \
"grpc.per_message_decompression"
/** Initial stream ID for http2 transports. Int valued. */
/** Initial stream ID for http2 transports. Int valued. Defaults to -1
indicating use of default http2 setting initial stream ID (1). */
#define GRPC_ARG_HTTP2_INITIAL_SEQUENCE_NUMBER \
"grpc.http2.initial_sequence_number"
/** Amount to read ahead on individual streams. Defaults to 64kb, larger
@ -75,17 +81,22 @@
NOTE: at some point we'd like to auto-tune this, and this parameter
will become a no-op. Int valued, bytes. */
#define GRPC_ARG_HTTP2_STREAM_LOOKAHEAD_BYTES "grpc.http2.lookahead_bytes"
/** How much memory to use for hpack decoding. Int valued, bytes. */
/** How much memory to use for hpack decoding. Int valued, bytes. Defaults to -1
indicating use of default http2 setting(4096 bytes). */
#define GRPC_ARG_HTTP2_HPACK_TABLE_SIZE_DECODER \
"grpc.http2.hpack_table_size.decoder"
/** How much memory to use for hpack encoding. Int valued, bytes. */
/** How much memory to use for hpack encoding. Int valued, bytes. Defaults to -1
indicating use of default http2 setting(4096 bytes). */
#define GRPC_ARG_HTTP2_HPACK_TABLE_SIZE_ENCODER \
"grpc.http2.hpack_table_size.encoder"
/** How big a frame are we willing to receive via HTTP2.
Min 16384, max 16777215. Larger values give lower CPU usage for large
messages, but more head of line blocking for small messages. */
messages, but more head of line blocking for small messages. Defaults to
-1(indicating no explicit max frame size), so it will take standard http/2
specified max frame size to 16 KB. */
#define GRPC_ARG_HTTP2_MAX_FRAME_SIZE "grpc.http2.max_frame_size"
/** Should BDP probing be performed? */
/** Should BDP probing be performed?
Boolean valued. Defaults to true(enabled). */
#define GRPC_ARG_HTTP2_BDP_PROBE "grpc.http2.bdp_probe"
/** (DEPRECATED) Does not have any effect.
Earlier, this arg configured the minimum time between successive ping frames
@ -109,21 +120,24 @@
before the request is cancelled */
#define GRPC_ARG_SERVER_MAX_UNREQUESTED_TIME_IN_SERVER_SECONDS \
"grpc.server_max_unrequested_time_in_server"
/** Channel arg to override the http2 :scheme header */
/** Channel arg to override the http2 :scheme header. String valued. */
#define GRPC_ARG_HTTP2_SCHEME "grpc.http2_scheme"
/** How many pings can the client send before needing to send a data/header
frame? (0 indicates that an infinite number of pings can be sent without
sending a data frame or header frame).
If experiment "max_pings_wo_data_throttle" is enabled, instead of pings being
completely blocked, they are throttled. */
completely blocked, they are throttled.
* Integer valued. Defaults to 2. */
#define GRPC_ARG_HTTP2_MAX_PINGS_WITHOUT_DATA \
"grpc.http2.max_pings_without_data"
/** How many misbehaving pings the server can bear before sending goaway and
closing the transport? (0 indicates that the server can bear an infinite
number of misbehaving pings) */
number of misbehaving pings)
* Integer valued. Defaults to 2. */
#define GRPC_ARG_HTTP2_MAX_PING_STRIKES "grpc.http2.max_ping_strikes"
/** How much data are we willing to queue up per stream if
GRPC_WRITE_BUFFER_HINT is set? This is an upper bound */
GRPC_WRITE_BUFFER_HINT is set? This is an upper bound
* Integer valued, bytes. Defaults to 65535 bytes. */
#define GRPC_ARG_HTTP2_WRITE_BUFFER_SIZE "grpc.http2.write_buffer_size"
/** Should we allow receipt of true-binary data on http2 connections?
Defaults to on (1) */
@ -136,33 +150,44 @@
#define GRPC_ARG_EXPERIMENTAL_HTTP2_PREFERRED_CRYPTO_FRAME_SIZE \
"grpc.experimental.http2.enable_preferred_frame_size"
/** After a duration of this time the client/server pings its peer to see if the
transport is still alive. Int valued, milliseconds. */
transport is still alive. Int valued, milliseconds. Defaults to 7200000 (2
hours). */
#define GRPC_ARG_KEEPALIVE_TIME_MS "grpc.keepalive_time_ms"
/** After waiting for a duration of this time, if the keepalive ping sender does
not receive the ping ack, it will close the transport. Int valued,
milliseconds. */
milliseconds. Defaults to 20000 (20 seonds). */
#define GRPC_ARG_KEEPALIVE_TIMEOUT_MS "grpc.keepalive_timeout_ms"
/** Is it permissible to send keepalive pings from the client without any
outstanding streams. Int valued, 0(false)/1(true). */
outstanding streams. Int valued, 0(false)/1(true). Defaults to 0. */
#define GRPC_ARG_KEEPALIVE_PERMIT_WITHOUT_CALLS \
"grpc.keepalive_permit_without_calls"
/** Default authority to pass if none specified on call construction. A string.
* */
#define GRPC_ARG_DEFAULT_AUTHORITY "grpc.default_authority"
/** Primary user agent: goes at the start of the user-agent metadata
sent on each request. A string. */
sent on each request. A string. Defaults to empty string(""). */
#define GRPC_ARG_PRIMARY_USER_AGENT_STRING "grpc.primary_user_agent"
/** Secondary user agent: goes at the end of the user-agent metadata
sent on each request. A string. */
#define GRPC_ARG_SECONDARY_USER_AGENT_STRING "grpc.secondary_user_agent"
/** The minimum time between subsequent connection attempts, in ms */
/** The minimum time between subsequent connection attempts, in ms. Refer to
* MIN_CONNECT_TIMEOUT from
* https://github.com/grpc/grpc/blob/master/doc/connection-backoff.md. Defaults
* to 20 seconds. */
#define GRPC_ARG_MIN_RECONNECT_BACKOFF_MS "grpc.min_reconnect_backoff_ms"
/** The maximum time between subsequent connection attempts, in ms */
/** The maximum time between subsequent connection attempts, in ms. Refer to
* MAX_BACKOFF from
* https://github.com/grpc/grpc/blob/master/doc/connection-backoff.md. Defaults
* to 120 seconds. */
#define GRPC_ARG_MAX_RECONNECT_BACKOFF_MS "grpc.max_reconnect_backoff_ms"
/** The time between the first and second connection attempts, in ms */
/** The time between the first and second connection attempts, in ms. Refer to
* INITIAL_BACKOFF from
* https://github.com/grpc/grpc/blob/master/doc/connection-backoff.md. Defaults
* to 1 second. */
#define GRPC_ARG_INITIAL_RECONNECT_BACKOFF_MS \
"grpc.initial_reconnect_backoff_ms"
/** Minimum amount of time between DNS resolutions, in ms */
/** Minimum amount of time between DNS resolutions, in ms. Defaults to 30
* seconds. */
#define GRPC_ARG_DNS_MIN_TIME_BETWEEN_RESOLUTIONS_MS \
"grpc.dns_min_time_between_resolutions_ms"
/** The timeout used on servers for finishing handshaking on an incoming
@ -178,10 +203,10 @@
#define GRPC_SSL_TARGET_NAME_OVERRIDE_ARG "grpc.ssl_target_name_override"
/** If non-zero, a pointer to a session cache (a pointer of type
grpc_ssl_session_cache*). (use grpc_ssl_session_cache_arg_vtable() to fetch
an appropriate pointer arg vtable) */
an appropriate pointer arg vtable). */
#define GRPC_SSL_SESSION_CACHE_ARG "grpc.ssl_session_cache"
/** If non-zero, it will determine the maximum frame size used by TSI's frame
* protector.
* protector. Defaults to zero.
*/
#define GRPC_ARG_TSI_MAX_FRAME_SIZE "grpc.tsi.max_frame_size"
/** Maximum metadata size (soft limit), in bytes. Note this limit applies to the
@ -200,17 +225,20 @@
#define GRPC_ARG_ALLOW_REUSEPORT "grpc.so_reuseport"
/** If non-zero, a pointer to a buffer pool (a pointer of type
* grpc_resource_quota*). (use grpc_resource_quota_arg_vtable() to fetch an
* appropriate pointer arg vtable) */
* appropriate pointer arg vtable). */
#define GRPC_ARG_RESOURCE_QUOTA "grpc.resource_quota"
/** If non-zero, expand wildcard addresses to a list of local addresses. */
/** If non-zero, expand wildcard addresses to a list of local addresses. Boolean
* valued. */
#define GRPC_ARG_EXPAND_WILDCARD_ADDRS "grpc.expand_wildcard_addrs"
/** Service config data in JSON form.
This value will be ignored if the name resolver returns a service config. */
This value will be ignored if the name resolver returns a service config. A
string value. */
#define GRPC_ARG_SERVICE_CONFIG "grpc.service_config"
/** Disable looking up the service config via the name resolver. */
/** Disable looking up the service config via the name resolver. Boolean valued.
* Defaults to true. */
#define GRPC_ARG_SERVICE_CONFIG_DISABLE_RESOLUTION \
"grpc.service_config_disable_resolution"
/** LB policy name. */
/** LB policy name. A string value.*/
#define GRPC_ARG_LB_POLICY_NAME "grpc.lb_policy_name"
/** Cap for ring size in the ring_hash LB policy. The min and max ring size
values set in the LB policy config will be capped to this value.
@ -223,24 +251,23 @@
/** The maximum amount of memory used by trace events per channel trace node.
* Once the maximum is reached, subsequent events will evict the oldest events
* from the buffer. The unit for this knob is bytes. Setting it to zero causes
* channel tracing to be disabled. */
* channel tracing to be disabled. Defaults to (1024 * 4) bytes. */
#define GRPC_ARG_MAX_CHANNEL_TRACE_EVENT_MEMORY_PER_NODE \
"grpc.max_channel_trace_event_memory_per_node"
/** If non-zero, gRPC library will track stats and information at at per channel
* level. Disabling channelz naturally disables channel tracing. The default
* is for channelz to be enabled. */
#define GRPC_ARG_ENABLE_CHANNELZ "grpc.enable_channelz"
/** If non-zero, Cronet transport will coalesce packets to fewer frames
* when possible. */
#define GRPC_ARG_USE_CRONET_PACKET_COALESCING \
"grpc.use_cronet_packet_coalescing"
/** Channel arg (integer) setting how large a slice to try and read from the
wire each time recvmsg (or equivalent) is called **/
wire each time recvmsg (or equivalent). Range varied from 1
to (32 * 1024 * 1024) bytes. Defaults to 8192 bytes. **/
#define GRPC_ARG_TCP_READ_CHUNK_SIZE "grpc.experimental.tcp_read_chunk_size"
/** Note this is not a "channel arg" key. This is the default slice size to use
* when trying to read from the wire if the GRPC_ARG_TCP_READ_CHUNK_SIZE
* channel arg is unspecified. */
#define GRPC_TCP_DEFAULT_READ_SLICE_SIZE 8192
/** Minimum read chunk size defaults to 256 bytes. Range varies from 1 to (32 *
* 1024 * 1024) bytes. */
#define GRPC_ARG_TCP_MIN_READ_CHUNK_SIZE \
"grpc.experimental.tcp_min_read_chunk_size"
#define GRPC_ARG_TCP_MAX_READ_CHUNK_SIZE \
@ -259,10 +286,12 @@
issued by the tcp_write(). By default, this is set to 4. */
#define GRPC_ARG_TCP_TX_ZEROCOPY_MAX_SIMULT_SENDS \
"grpc.experimental.tcp_tx_zerocopy_max_simultaneous_sends"
/* Overrides the TCP socket recieve buffer size, SO_RCVBUF. */
/* Overrides the TCP socket receive buffer size, SO_RCVBUF.
Default value is -1(kReadBufferSizeUnset) indicating that the system will
decide the buffer size. Range varies from 0 to INT_MAX. */
#define GRPC_ARG_TCP_RECEIVE_BUFFER_SIZE "grpc.tcp_receive_buffer_size"
/* Timeout in milliseconds to use for calls to the grpclb load balancer.
If 0 or unset, the balancer calls will have no deadline. */
If 0 or unset, the balancer calls will have no deadline. Defaults to 0 ms. */
#define GRPC_ARG_GRPCLB_CALL_TIMEOUT_MS "grpc.grpclb_call_timeout_ms"
/* Specifies the xDS bootstrap config as a JSON string.
FOR TESTING PURPOSES ONLY -- DO NOT USE IN PRODUCTION.
@ -277,7 +306,7 @@
"grpc.TEST_ONLY_DO_NOT_USE_IN_PROD.xds_bootstrap_config"
/* Timeout in milliseconds to wait for the serverlist from the grpclb load
balancer before using fallback backend addresses from the resolver.
If 0, enter fallback mode immediately. Default value is 10000. */
If 0, enter fallback mode immediately. Default value is 10000ms. */
#define GRPC_ARG_GRPCLB_FALLBACK_TIMEOUT_MS "grpc.grpclb_fallback_timeout_ms"
/* Experimental Arg. Channel args to be used for the control-plane channel
* created to the grpclb load balancers. This is a pointer arg whose value is a
@ -290,9 +319,6 @@
over to the next priority. Default value is 10 seconds. */
#define GRPC_ARG_PRIORITY_FAILOVER_TIMEOUT_MS \
"grpc.priority_failover_timeout_ms"
/** If non-zero, grpc server's cronet compression workaround will be enabled */
#define GRPC_ARG_WORKAROUND_CRONET_COMPRESSION \
"grpc.workaround.cronet_compression"
/** String defining the optimization target for a channel.
Can be: "latency" - attempt to minimize latency at the cost of throughput
"blend" - try to balance latency and throughput
@ -325,13 +351,15 @@
/** Channel arg that carries the bridged objective c object for custom metrics
* logging filter. */
#define GRPC_ARG_MOBILE_LOG_CONTEXT "grpc.mobile_log_context"
/** If non-zero, client authority filter is disabled for the channel */
/** If non-zero, client authority filter is disabled for the channel.
* Boolean valued. Defaults to false. */
#define GRPC_ARG_DISABLE_CLIENT_AUTHORITY_FILTER \
"grpc.disable_client_authority_filter"
/** If set to zero, disables use of http proxies. Enabled by default. */
#define GRPC_ARG_ENABLE_HTTP_PROXY "grpc.enable_http_proxy"
/** Channel arg to set http proxy per channel. If set, the channel arg
* value will be preferred over the environment variable settings. */
* value will be preferred over the environment variable settings. String
* value. */
#define GRPC_ARG_HTTP_PROXY "grpc.http_proxy"
/** Specifies an HTTP proxy to use for individual addresses.
* The proxy must be specified as an IP address, not a DNS name.
@ -347,7 +375,7 @@
agent is surfaced by default. */
#define GRPC_ARG_SURFACE_USER_AGENT "grpc.surface_user_agent"
/** If set, inhibits health checking (which may be enabled via the
* service config.) */
* service config.). Boolean valued. Defaults to false. */
#define GRPC_ARG_INHIBIT_HEALTH_CHECKING "grpc.inhibit_health_checking"
/** If enabled, the channel's DNS resolver queries for SRV records.
* This is useful only when using the "grpclb" load balancing policy,
@ -356,17 +384,17 @@
* https://github.com/grpc/proposal/blob/master/A24-lb-policy-config.md
* https://github.com/grpc/proposal/blob/master/A26-grpclb-selection.md
* Note that this works only with the "ares" DNS resolver; it isn't supported
* by the "native" DNS resolver. */
* by the "native" DNS resolver. Boolean valued. Defaults to false. */
#define GRPC_ARG_DNS_ENABLE_SRV_QUERIES "grpc.dns_enable_srv_queries"
/** If set, determines an upper bound on the number of milliseconds that the
* c-ares based DNS resolver will wait on queries before cancelling them.
* The default value is 120,000. Setting this to "0" will disable the
* The default value is 120,000ms. Setting this to "0" will disable the
* overall timeout entirely. Note that this doesn't include internal c-ares
* timeouts/backoff/retry logic, and so the actual DNS resolution may time out
* sooner than the value specified here. */
#define GRPC_ARG_DNS_ARES_QUERY_TIMEOUT_MS "grpc.dns_ares_query_timeout"
/** If set, uses a local subchannel pool within the channel. Otherwise, uses the
* global subchannel pool. */
* global subchannel pool. Boolean valued. Defaults to false. */
#define GRPC_ARG_USE_LOCAL_SUBCHANNEL_POOL "grpc.use_local_subchannel_pool"
/** gRPC Objective-C channel pooling domain string. */
#define GRPC_ARG_CHANNEL_POOL_DOMAIN "grpc.channel_pooling_domain"
@ -400,6 +428,8 @@
"grpc.max_allowed_incoming_connections"
/** Configure per-channel or per-server stats plugins. */
#define GRPC_ARG_EXPERIMENTAL_STATS_PLUGINS "grpc.experimental.stats_plugins"
/** If non-zero, allow security frames to be sent and received. */
#define GRPC_ARG_SECURITY_FRAME_ALLOWED "grpc.security_frame_allowed"
/** \} */
#endif /* GRPC_IMPL_CHANNEL_ARG_NAMES_H */

View File

@ -41,8 +41,9 @@ extern "C" {
* Its value is an int from the \a grpc_compression_algorithm enum. */
#define GRPC_COMPRESSION_CHANNEL_DEFAULT_ALGORITHM \
"grpc.default_compression_algorithm"
/** Default compression level for the channel.
* Its value is an int from the \a grpc_compression_level enum. */
/** Set the default compression level for the channel.
* Valid values are defined by the enum type grpc_compression_level, defaults to
* GRPC_COMPRESS_LEVEL_NONE. */
#define GRPC_COMPRESSION_CHANNEL_DEFAULT_LEVEL "grpc.default_compression_level"
/** Compression algorithms supported by the channel.
* Its value is a bitset (an int). Bits correspond to algorithms in \a

View File

@ -21,14 +21,13 @@
// IWYU pragma: private, include <grpc/grpc.h>
#include <stddef.h>
#include <grpc/impl/channel_arg_names.h>
#include <grpc/impl/compression_types.h>
#include <grpc/slice.h>
#include <grpc/status.h>
#include <grpc/support/port_platform.h>
#include <grpc/support/time.h>
#include <stddef.h>
#ifdef __cplusplus
extern "C" {

View File

@ -21,9 +21,8 @@
// IWYU pragma: private, include <grpc/slice.h>
#include <stddef.h>
#include <grpc/support/port_platform.h>
#include <stddef.h>
typedef struct grpc_slice grpc_slice;
@ -74,7 +73,7 @@ struct grpc_slice {
} data;
};
#define GRPC_SLICE_BUFFER_INLINE_ELEMENTS 6
#define GRPC_SLICE_BUFFER_INLINE_ELEMENTS 3
/** Represents an expandable array of slices, to be interpreted as a
single item. */

View File

@ -14,10 +14,10 @@
#ifndef GRPC_PASSIVE_LISTENER_H
#define GRPC_PASSIVE_LISTENER_H
#include <memory>
#include <grpc/event_engine/event_engine.h>
#include <grpc/grpc.h>
#include <memory>
// #include <grpc/support/port_platform.h>
namespace grpc_core {

View File

@ -146,7 +146,7 @@ typedef enum {
GRPC_STATUS_DATA_LOSS = 15,
/** Force users to include a default branch: */
GRPC_STATUS__DO_NOT_USE = -1
GRPC_STATUS__DO_NOT_USE = 0x7fffffffu,
} grpc_status_code;
#ifdef __cplusplus

View File

@ -19,9 +19,8 @@
#ifndef GRPC_SUPPORT_ALLOC_H
#define GRPC_SUPPORT_ALLOC_H
#include <stddef.h>
#include <grpc/support/port_platform.h>
#include <stddef.h>
#ifdef __cplusplus
extern "C" {

View File

@ -79,17 +79,4 @@
#error could not determine platform for atm
#endif
#ifdef __cplusplus
extern "C" {
#endif
/** Adds \a delta to \a *value, clamping the result to the range specified
by \a min and \a max. Returns the new value. */
gpr_atm gpr_atm_no_barrier_clamped_add(gpr_atm* value, gpr_atm delta,
gpr_atm min, gpr_atm max);
#ifdef __cplusplus
}
#endif
#endif /* GRPC_SUPPORT_ATM_H */

View File

@ -17,17 +17,17 @@
#ifndef GRPC_SUPPORT_JSON_H
#define GRPC_SUPPORT_JSON_H
#include <grpc/support/port_platform.h>
#include <stdint.h>
#include <map>
#include <string>
#include <type_traits>
#include <utility>
#include <variant>
#include <vector>
#include "absl/strings/str_cat.h"
#include "absl/types/variant.h"
#include <grpc/support/port_platform.h>
namespace grpc_core {
namespace experimental {
@ -73,27 +73,8 @@ class Json {
json.value_ = NumberValue{std::move(str)};
return json;
}
static Json FromNumber(int32_t value) {
Json json;
json.value_ = NumberValue{absl::StrCat(value)};
return json;
}
static Json FromNumber(uint32_t value) {
Json json;
json.value_ = NumberValue{absl::StrCat(value)};
return json;
}
static Json FromNumber(int64_t value) {
Json json;
json.value_ = NumberValue{absl::StrCat(value)};
return json;
}
static Json FromNumber(uint64_t value) {
Json json;
json.value_ = NumberValue{absl::StrCat(value)};
return json;
}
static Json FromNumber(double value) {
template <typename T>
static std::enable_if_t<std::is_arithmetic_v<T>, Json> FromNumber(T value) {
Json json;
json.value_ = NumberValue{absl::StrCat(value)};
return json;
@ -148,46 +129,46 @@ class Json {
// Moveable.
Json(Json&& other) noexcept : value_(std::move(other.value_)) {
other.value_ = absl::monostate();
other.value_ = std::monostate();
}
Json& operator=(Json&& other) noexcept {
value_ = std::move(other.value_);
other.value_ = absl::monostate();
other.value_ = std::monostate();
return *this;
}
// Returns the JSON type.
Type type() const {
struct ValueFunctor {
Json::Type operator()(const absl::monostate&) { return Type::kNull; }
Json::Type operator()(const std::monostate&) { return Type::kNull; }
Json::Type operator()(bool) { return Type::kBoolean; }
Json::Type operator()(const NumberValue&) { return Type::kNumber; }
Json::Type operator()(const std::string&) { return Type::kString; }
Json::Type operator()(const Object&) { return Type::kObject; }
Json::Type operator()(const Array&) { return Type::kArray; }
};
return absl::visit(ValueFunctor(), value_);
return std::visit(ValueFunctor(), value_);
}
// Payload accessor for kBoolean.
// Must not be called for other types.
bool boolean() const { return absl::get<bool>(value_); }
bool boolean() const { return std::get<bool>(value_); }
// Payload accessor for kNumber or kString.
// Must not be called for other types.
const std::string& string() const {
const NumberValue* num = absl::get_if<NumberValue>(&value_);
const NumberValue* num = std::get_if<NumberValue>(&value_);
if (num != nullptr) return num->value;
return absl::get<std::string>(value_);
return std::get<std::string>(value_);
}
// Payload accessor for kObject.
// Must not be called for other types.
const Object& object() const { return absl::get<Object>(value_); }
const Object& object() const { return std::get<Object>(value_); }
// Payload accessor for kArray.
// Must not be called for other types.
const Array& array() const { return absl::get<Array>(value_); }
const Array& array() const { return std::get<Array>(value_); }
bool operator==(const Json& other) const { return value_ == other.value_; }
bool operator!=(const Json& other) const { return !(*this == other); }
@ -200,12 +181,12 @@ class Json {
return value == other.value;
}
};
using Value = absl::variant<absl::monostate, // kNull
bool, // kBoolean
NumberValue, // kNumber
std::string, // kString
Object, // kObject
Array>; // kArray
using Value = std::variant<std::monostate, // kNull
bool, // kBoolean
NumberValue, // kNumber
std::string, // kString
Object, // kObject
Array>; // kArray
explicit Json(Value value) : value_(std::move(value)) {}

View File

@ -19,75 +19,65 @@
#ifndef GRPC_SUPPORT_LOG_H
#define GRPC_SUPPORT_LOG_H
#include <grpc/support/port_platform.h>
#include <stdarg.h>
#include <stdlib.h> /* for abort() */
#include <grpc/support/port_platform.h>
#ifdef __cplusplus
extern "C" {
#endif
/** GPR log API.
Usage (within grpc):
int argument1 = 3;
char* argument2 = "hello";
gpr_log(GPR_DEBUG, "format string %d", argument1);
gpr_log(GPR_INFO, "hello world");
gpr_log(GPR_ERROR, "%d %s!!", argument1, argument2); */
/** The severity of a log message - use the #defines below when calling into
gpr_log to additionally supply file and line data */
grpc_absl_log to additionally supply file and line data */
typedef enum gpr_log_severity {
GPR_LOG_SEVERITY_DEBUG,
GPR_LOG_SEVERITY_INFO,
GPR_LOG_SEVERITY_ERROR
} gpr_log_severity;
/** Returns a string representation of the log severity */
GPRAPI const char* gpr_log_severity_string(gpr_log_severity severity);
/** Macros to build log contexts at various severity levels */
#define GPR_DEBUG __FILE__, __LINE__, GPR_LOG_SEVERITY_DEBUG
#define GPR_INFO __FILE__, __LINE__, GPR_LOG_SEVERITY_INFO
#define GPR_ERROR __FILE__, __LINE__, GPR_LOG_SEVERITY_ERROR
/** Log a message. It's advised to use GPR_xxx above to generate the context
* for each message */
GPRAPI void gpr_log(const char* file, int line, gpr_log_severity severity,
const char* format, ...) GPR_PRINT_FORMAT_CHECK(4, 5);
/**
* EXPERIMENTAL. API stability not guaranteed.
* Should only be used from gRPC PHP and RUBY.
* This will be removed once Ruby and PHP can start using C++ APIs.
* We would replace this with calls to absl LOG functions.
* grpc_absl_log is equivalent to
* ABSL_LOG(severity) << message_str;
* **/
GPRAPI void grpc_absl_log(const char* file, int line, gpr_log_severity severity,
const char* message_str);
GPRAPI int gpr_should_log(gpr_log_severity severity);
/**
* EXPERIMENTAL. API stability not guaranteed.
* Should only be used from gRPC PHP and RUBY.
* This will be removed once Ruby and PHP can start using C++ APIs.
* We would replace this with calls to absl LOG functions.
* grpc_absl_log_int is equivalent to
* ABSL_LOG(severity) << message_str << num;
* **/
GPRAPI void grpc_absl_log_int(const char* file, int line,
gpr_log_severity severity,
const char* message_str, intptr_t num);
GPRAPI void gpr_log_message(const char* file, int line,
gpr_log_severity severity, const char* message);
/** Set global log verbosity */
GPRAPI void gpr_set_log_verbosity(gpr_log_severity min_severity_to_print);
/**
* EXPERIMENTAL. API stability not guaranteed.
* Should only be used from gRPC PHP and RUBY.
* This will be removed once Ruby and PHP can start using C++ APIs.
* We would replace this with calls to absl LOG functions.
* grpc_absl_log_str is equivalent to
* ABSL_LOG(severity) << message_str1 << message_str2;
* **/
GPRAPI void grpc_absl_log_str(const char* file, int line,
gpr_log_severity severity,
const char* message_str1,
const char* message_str2);
GPRAPI void gpr_log_verbosity_init(void);
/** Log overrides: applications can use this API to intercept logging calls
and use their own implementations */
struct gpr_log_func_args {
const char* file;
int line;
gpr_log_severity severity;
const char* message;
};
typedef struct gpr_log_func_args gpr_log_func_args;
typedef void (*gpr_log_func)(gpr_log_func_args* args);
GPRAPI void gpr_set_log_function(gpr_log_func func);
GPRAPI void gpr_assertion_failed(const char* filename, int line,
const char* message) GPR_ATTRIBUTE_NORETURN;
#ifdef __cplusplus
}
#endif

View File

@ -15,20 +15,26 @@
#ifndef GRPC_SUPPORT_METRICS_H
#define GRPC_SUPPORT_METRICS_H
#include "absl/strings/string_view.h"
#include <grpc/event_engine/endpoint_config.h>
#include <grpc/support/port_platform.h>
#include "absl/strings/string_view.h"
namespace grpc_core {
namespace experimental {
// Configuration (scope) for a specific client channel to be used for stats
// plugins.
// plugins. For some components like XdsClient where the same XdsClient instance
// can be shared across multiple channels that share the same target name but
// have different default authority and channel arguments, the component uses
// the configuration from the first channel that uses this XdsClient instance to
// determine StatsPluginChannelScope.
class StatsPluginChannelScope {
public:
StatsPluginChannelScope(absl::string_view target,
absl::string_view default_authority)
: target_(target), default_authority_(default_authority) {}
StatsPluginChannelScope(
absl::string_view target, absl::string_view default_authority,
const grpc_event_engine::experimental::EndpointConfig& args)
: target_(target), default_authority_(default_authority), args_(args) {}
/// Returns the target used for creating the channel in the canonical form.
/// (Canonicalized target definition -
@ -36,13 +42,22 @@ class StatsPluginChannelScope {
absl::string_view target() const { return target_; }
/// Returns the default authority for the channel.
absl::string_view default_authority() const { return default_authority_; }
/// Returns channel arguments. THIS METHOD IS EXPERIMENTAL.
// TODO(roth, ctiller, yashkt): Find a better representation for
// channel args before de-experimentalizing this API.
const grpc_event_engine::experimental::EndpointConfig& experimental_args()
const {
return args_;
}
private:
// Disable copy constructor and copy-assignment operator.
StatsPluginChannelScope(const StatsPluginChannelScope&) = delete;
StatsPluginChannelScope& operator=(const StatsPluginChannelScope&) = delete;
absl::string_view target_;
absl::string_view default_authority_;
const grpc_event_engine::experimental::EndpointConfig& args_;
};
} // namespace experimental

View File

@ -26,17 +26,20 @@
#define GRPC_DEPRECATED(reason)
#endif // __cplusplus >= 201402L
#ifndef GPR_DISABLE_ABSEIL_SYNC
/*
* Defines GPR_ABSEIL_SYNC to use synchronization features from Abseil
*
* You can opt for gRPC's native synchronization by enabling
* GPR_DISABLE_ABSEIL_SYNC. However, this flag is temporary and will be
* removed once the Abseil synchronization is stabilized.
* If you encounter any issues with this feature, please report them
* by filing a bug at https://github.com/grpc/grpc.
*/
#ifndef GPR_ABSEIL_SYNC
#if defined(__APPLE__)
// This is disabled on Apple platforms because macos/grpc_basictests_c_cpp
// fails with this. https://github.com/grpc/grpc/issues/23661
#else
#define GPR_ABSEIL_SYNC 1
#endif
#endif // GPR_ABSEIL_SYNC
#endif // GPR_DISABLE_ABSEIL_SYNC
/* Get windows.h included everywhere (we need it) */
#if defined(_WIN64) || defined(WIN64) || defined(_WIN32) || defined(WIN32)
@ -172,7 +175,6 @@
#if __ANDROID_API__ < 21
#error "Requires Android API v21 and above"
#endif
#define GPR_SUPPORT_BINDER_TRANSPORT 1
// TODO(apolcyn): re-evaluate support for c-ares
// on android after upgrading our c-ares dependency.
// See https://github.com/grpc/grpc/issues/18038.
@ -195,6 +197,12 @@
#define GPR_HAS_PTHREAD_H 1
#define GPR_GETPID_IN_UNISTD_H 1
#define GPR_SUPPORT_CHANNELS_FROM_FD 1
#if defined(__has_include)
#if __has_include(<android/ndk-version.h>)
#include <android/ndk-version.h>
#endif /* __has_include(<android/ndk-version.h>) */
#endif /* defined(__has_include) */
#include <linux/version.h>
#elif defined(__linux__)
#define GPR_PLATFORM_STRING "linux"
#ifndef _BSD_SOURCE
@ -746,6 +754,22 @@ extern void gpr_unreachable_code(const char* reason, const char* file,
#endif
#endif /* GPR_ATTRIBUTE_NOINLINE */
#ifndef GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION
#ifdef __cplusplus
#if GPR_HAS_CPP_ATTRIBUTE(clang::always_inline)
#define GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION [[clang::always_inline]]
#elif GPR_HAS_ATTRIBUTE(always_inline)
#define GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION __attribute__((always_inline))
#else
// TODO(ctiller): add __forceinline for MSVC
#define GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION
#endif
#else
// Disable for C code
#define GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION
#endif
#endif /* GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION */
#ifndef GPR_NO_UNIQUE_ADDRESS
#if GPR_HAS_CPP_ATTRIBUTE(no_unique_address)
#define GPR_NO_UNIQUE_ADDRESS [[no_unique_address]]
@ -820,6 +844,12 @@ extern void gpr_unreachable_code(const char* reason, const char* file,
#endif /* __GPR_WINDOWS */
#endif /* GRPC_ALLOW_EXCEPTIONS */
#ifdef __has_builtin
#define GRPC_HAS_BUILTIN(a) __has_builtin(a)
#else
#define GRPC_HAS_BUILTIN(a) 0
#endif
/* Use GPR_LIKELY only in cases where you are sure that a certain outcome is the
* most likely. Ideally, also collect performance numbers to justify the claim.
*/

View File

@ -29,8 +29,7 @@ typedef struct {
gpr_atm state;
} gpr_event;
#define GPR_EVENT_INIT \
{ 0 }
#define GPR_EVENT_INIT {0}
/* gpr_refcount */
typedef struct {
@ -42,7 +41,6 @@ typedef struct {
gpr_atm value;
} gpr_stats_counter;
#define GPR_STATS_INIT \
{ 0 }
#define GPR_STATS_INIT {0}
#endif /* GRPC_SUPPORT_SYNC_GENERIC_H */

View File

@ -19,10 +19,9 @@
#ifndef GRPC_SUPPORT_SYNC_POSIX_H
#define GRPC_SUPPORT_SYNC_POSIX_H
#include <pthread.h>
#include <grpc/support/port_platform.h>
#include <grpc/support/sync_generic.h>
#include <pthread.h>
#ifdef GRPC_ASAN_ENABLED
/* The member |leak_checker| is used to check whether there is a memory leak

View File

@ -19,11 +19,10 @@
#ifndef GRPC_SUPPORT_TIME_H
#define GRPC_SUPPORT_TIME_H
#include <grpc/support/port_platform.h>
#include <stddef.h>
#include <time.h>
#include <grpc/support/port_platform.h>
#ifdef __cplusplus
extern "C" {
#endif

View File

@ -23,9 +23,6 @@
* explanation and detailed descriptions of workarounds, see
* /doc/workarounds.md
*/
typedef enum {
GRPC_WORKAROUND_ID_CRONET_COMPRESSION = 0,
GRPC_MAX_WORKAROUND_ID
} grpc_workaround_list;
typedef enum { GRPC_MAX_WORKAROUND_ID } grpc_workaround_list;
#endif /* GRPC_SUPPORT_WORKAROUND_LIST_H */

View File

@ -21,8 +21,6 @@
#ifndef GRPCPP_ALARM_H
#define GRPCPP_ALARM_H
#include <functional>
#include <grpc/event_engine/event_engine.h>
#include <grpc/grpc.h>
#include <grpcpp/completion_queue.h>
@ -30,6 +28,8 @@
#include <grpcpp/impl/grpc_library.h>
#include <grpcpp/support/time.h>
#include <functional>
namespace grpc {
/// Trigger a \a CompletionQueue event, or asynchronous callback execution,

View File

@ -19,8 +19,6 @@
#ifndef GRPCPP_CHANNEL_H
#define GRPCPP_CHANNEL_H
#include <memory>
#include <grpc/grpc.h>
#include <grpcpp/completion_queue.h>
#include <grpcpp/impl/call.h>
@ -30,6 +28,8 @@
#include <grpcpp/support/client_interceptor.h>
#include <grpcpp/support/config.h>
#include <memory>
struct grpc_channel;
namespace grpc {

View File

@ -34,15 +34,8 @@
#ifndef GRPCPP_CLIENT_CONTEXT_H
#define GRPCPP_CLIENT_CONTEXT_H
#include <map>
#include <memory>
#include <string>
#include "absl/log/absl_check.h"
#include <grpc/impl/compression_types.h>
#include <grpc/impl/propagation_bits.h>
#include <grpc/support/log.h>
#include <grpcpp/impl/create_auth_context.h>
#include <grpcpp/impl/metadata_map.h>
#include <grpcpp/impl/rpc_method.h>
@ -55,6 +48,12 @@
#include <grpcpp/support/string_ref.h>
#include <grpcpp/support/time.h>
#include <map>
#include <memory>
#include <string>
#include "absl/log/absl_check.h"
struct census_context;
struct grpc_call;

View File

@ -32,21 +32,20 @@
#ifndef GRPCPP_COMPLETION_QUEUE_H
#define GRPCPP_COMPLETION_QUEUE_H
#include <list>
#include "absl/log/absl_check.h"
#include <grpc/grpc.h>
#include <grpc/support/atm.h>
#include <grpc/support/log.h>
#include <grpc/support/time.h>
#include <grpcpp/impl/codegen/rpc_service_method.h>
#include <grpcpp/impl/codegen/status.h>
#include <grpcpp/impl/codegen/sync.h>
#include <grpcpp/impl/codegen/time.h>
#include <grpcpp/impl/completion_queue_tag.h>
#include <grpcpp/impl/grpc_library.h>
#include <grpcpp/impl/sync.h>
#include <grpcpp/support/status.h>
#include <list>
#include "absl/log/absl_check.h"
struct grpc_completion_queue;

View File

@ -19,14 +19,14 @@
#ifndef GRPCPP_CREATE_CHANNEL_H
#define GRPCPP_CREATE_CHANNEL_H
#include <memory>
#include <grpcpp/channel.h>
#include <grpcpp/security/credentials.h>
#include <grpcpp/support/channel_arguments.h>
#include <grpcpp/support/client_interceptor.h>
#include <grpcpp/support/config.h>
#include <memory>
namespace grpc {
/// Create a new \a Channel pointing to \a target.
///

View File

@ -1,126 +0,0 @@
// Copyright 2021 gRPC 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
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef GRPCPP_CREATE_CHANNEL_BINDER_H
#define GRPCPP_CREATE_CHANNEL_BINDER_H
#include <grpc/support/port_platform.h>
#ifdef GPR_ANDROID
#include <jni.h>
#include <memory>
#include "absl/strings/string_view.h"
#include <grpcpp/channel.h>
#include <grpcpp/security/binder_security_policy.h>
#include <grpcpp/support/channel_arguments.h>
namespace grpc {
namespace experimental {
/// EXPERIMENTAL Create a new \a Channel based on binder transport. The package
/// name and class name will be used identify the specific application component
/// to connect to.
///
/// \param jni_env_void Pointer to a JNIEnv structure
/// \param context The context that we will use to invoke \a bindService See
/// https://developer.android.com/reference/android/content/Context#bindService(android.content.Intent,%20android.content.ServiceConnection,%20int)
/// for detail.
/// \param package_name Package name of the component to be connected to
/// \param class_name Class name of the component to be connected to
/// \param security_policy Used for checking if remote component is allowed to
/// connect
std::shared_ptr<grpc::Channel> CreateBinderChannel(
void* jni_env_void, jobject context, absl::string_view package_name,
absl::string_view class_name,
std::shared_ptr<grpc::experimental::binder::SecurityPolicy>
security_policy);
/// EXPERIMENTAL Create a new \a Channel based on binder transport. The package
/// name and class name will be used identify the specific application component
/// to connect to.
///
/// \param jni_env_void Pointer to a JNIEnv structure
/// \param context The context that we will use to invoke \a bindService See
/// https://developer.android.com/reference/android/content/Context#bindService(android.content.Intent,%20android.content.ServiceConnection,%20int)
/// for detail.
/// \param package_name Package name of the component to be connected to
/// \param class_name Class name of the component to be connected to
/// \param security_policy Used for checking if remote component is allowed to
/// connect
/// \param args Options for channel creation.
std::shared_ptr<grpc::Channel> CreateCustomBinderChannel(
void* jni_env_void, jobject context, absl::string_view package_name,
absl::string_view class_name,
std::shared_ptr<grpc::experimental::binder::SecurityPolicy> security_policy,
const ChannelArguments& args);
/// EXPERIMENTAL Create a new \a Channel based on binder transport.
///
/// \param jni_env_void Pointer to a JNIEnv structure
/// \param context The context that we will use to invoke \a bindService See
/// https://developer.android.com/reference/android/content/Context#bindService(android.content.Intent,%20android.content.ServiceConnection,%20int)
/// for detail.
/// \param uri An URI that can be parsed as an `Intent` with
/// https://developer.android.com/reference/android/content/Intent#parseUri(java.lang.String,%20int)
/// \param security_policy Used for checking if remote component is allowed to
/// connect
std::shared_ptr<grpc::Channel> CreateBinderChannel(
void* jni_env_void, jobject context, absl::string_view uri,
std::shared_ptr<grpc::experimental::binder::SecurityPolicy>
security_policy);
/// EXPERIMENTAL Create a new \a Channel based on binder transport.
///
/// \param jni_env_void Pointer to a JNIEnv structure
/// \param context The context that we will use to invoke \a bindService See
/// https://developer.android.com/reference/android/content/Context#bindService(android.content.Intent,%20android.content.ServiceConnection,%20int)
/// for detail.
/// \param uri An URI that can be parsed as an `Intent` with
/// https://developer.android.com/reference/android/content/Intent#parseUri(java.lang.String,%20int)
/// \param security_policy Used for checking if remote component is allowed to
/// connect
/// \param args Options for channel creation.
std::shared_ptr<grpc::Channel> CreateCustomBinderChannel(
void* jni_env_void, jobject context, absl::string_view uri,
std::shared_ptr<grpc::experimental::binder::SecurityPolicy> security_policy,
const ChannelArguments& args);
/// EXPERIMENTAL Finds internal binder transport Java code. To create channels
/// in threads created in native code, it is required to call this function
/// once beforehand in a thread that is not created in native code.
/// See
/// https://developer.android.com/training/articles/perf-jni#faq:-why-didnt-findclass-find-my-class
/// for details of this limitation.
/// Returns true when the initialization is successful.
bool InitializeBinderChannelJavaClass(void* jni_env_void);
/// EXPERIMENTAL Alternative version of `InitializeBinderChannelJavaClass(void*
/// jni_env_void)`. This version used a user-specified function to find the
/// required internal Java class. When a class is found, the `class_finder`
/// function should return a local reference to the class (jclass type). The
/// returned jclass will then be used to create global reference for gRPC to use
/// it later. After that, gRPC will DeleteLocalRef the returned local reference.
bool InitializeBinderChannelJavaClass(
void* jni_env_void, std::function<void*(std::string)> class_finder);
} // namespace experimental
} // namespace grpc
#endif
#endif // GRPCPP_CREATE_CHANNEL_BINDER_H

View File

@ -19,12 +19,12 @@
#ifndef GRPCPP_CREATE_CHANNEL_POSIX_H
#define GRPCPP_CREATE_CHANNEL_POSIX_H
#include <memory>
#include <grpc/support/port_platform.h>
#include <grpcpp/channel.h>
#include <grpcpp/support/channel_arguments.h>
#include <memory>
namespace grpc {
#ifdef GPR_SUPPORT_CHANNELS_FROM_FD

View File

@ -19,21 +19,20 @@
#ifndef GRPCPP_EXT_CALL_METRIC_RECORDER_H
#define GRPCPP_EXT_CALL_METRIC_RECORDER_H
#include <grpcpp/impl/sync.h>
#include <grpcpp/support/slice.h>
#include <memory>
#include <string>
#include "absl/strings/string_view.h"
#include "absl/types/optional.h"
#include <grpcpp/impl/sync.h>
#include <grpcpp/support/slice.h>
namespace grpc {
namespace experimental {
/// Records call metrics for the purpose of load balancing.
/// During an RPC, call \a ServerContext::ExperimentalGetCallMetricRecorder()
/// method to retrive the recorder for the current call.
/// method to retrieve the recorder for the current call.
class CallMetricRecorder {
public:
virtual ~CallMetricRecorder() = default;

View File

@ -19,12 +19,12 @@
#ifndef GRPCPP_EXT_HEALTH_CHECK_SERVICE_SERVER_BUILDER_OPTION_H
#define GRPCPP_EXT_HEALTH_CHECK_SERVICE_SERVER_BUILDER_OPTION_H
#include <memory>
#include <grpcpp/health_check_service_interface.h>
#include <grpcpp/impl/server_builder_option.h>
#include <grpcpp/support/config.h>
#include <memory>
namespace grpc {
class HealthCheckServiceServerBuilderOption : public ServerBuilderOption {

View File

@ -19,13 +19,13 @@
#ifndef GRPCPP_EXT_SERVER_METRIC_RECORDER_H
#define GRPCPP_EXT_SERVER_METRIC_RECORDER_H
#include <grpcpp/impl/sync.h>
#include <grpcpp/support/string_ref.h>
#include <functional>
#include <map>
#include <memory>
#include <grpcpp/impl/sync.h>
#include <grpcpp/support/string_ref.h>
namespace grpc_core {
struct BackendMetricData;
} // namespace grpc_core

View File

@ -19,13 +19,6 @@
#ifndef GRPCPP_IMPL_CALL_OP_SET_H
#define GRPCPP_IMPL_CALL_OP_SET_H
#include <cstring>
#include <map>
#include <memory>
#include "absl/log/absl_check.h"
#include "absl/log/absl_log.h"
#include <grpc/grpc.h>
#include <grpc/impl/compression_types.h>
#include <grpc/impl/grpc_types.h>
@ -45,6 +38,13 @@
#include <grpcpp/support/slice.h>
#include <grpcpp/support/string_ref.h>
#include <cstring>
#include <map>
#include <memory>
#include "absl/log/absl_check.h"
#include "absl/log/absl_log.h"
namespace grpc {
namespace internal {

View File

@ -19,12 +19,12 @@
#ifndef GRPCPP_IMPL_CHANNEL_ARGUMENT_OPTION_H
#define GRPCPP_IMPL_CHANNEL_ARGUMENT_OPTION_H
#include <map>
#include <memory>
#include <grpcpp/impl/server_builder_option.h>
#include <grpcpp/support/channel_arguments.h>
#include <map>
#include <memory>
namespace grpc {
std::unique_ptr<ServerBuilderOption> MakeChannelArgumentOption(

View File

@ -21,7 +21,7 @@
// IWYU pragma: private
#define GRPC_OPEN_SOURCE_PROTO
// #define GRPC_OPEN_SOURCE_PROTO
#define GRPC_PROTOBUF_CORD_SUPPORT_ENABLED
@ -40,7 +40,7 @@
#ifndef GRPC_CUSTOM_DESCRIPTOR
#include <google/protobuf/descriptor.h>
#include <google/protobuf/descriptor.pb.h>
#if GOOGLE_PROTOBUF_VERSION >= 4025000
#if !defined(GOOGLE_PROTOBUF_VERSION) || GOOGLE_PROTOBUF_VERSION >= 4025000
#define GRPC_PROTOBUF_EDITION_SUPPORT
#endif
#define GRPC_CUSTOM_DESCRIPTOR ::google::protobuf::Descriptor
@ -71,6 +71,7 @@
#define GRPC_CUSTOM_ZEROCOPYINPUTSTREAM \
::google::protobuf::io::ZeroCopyInputStream
#define GRPC_CUSTOM_CODEDINPUTSTREAM ::google::protobuf::io::CodedInputStream
#define GRPC_CUSTOM_CODEDOUTPUTSTREAM ::google::protobuf::io::CodedOutputStream
#endif
#ifndef GRPC_CUSTOM_JSONUTIL
@ -113,6 +114,7 @@ namespace io {
typedef GRPC_CUSTOM_ZEROCOPYOUTPUTSTREAM ZeroCopyOutputStream;
typedef GRPC_CUSTOM_ZEROCOPYINPUTSTREAM ZeroCopyInputStream;
typedef GRPC_CUSTOM_CODEDINPUTSTREAM CodedInputStream;
typedef GRPC_CUSTOM_CODEDOUTPUTSTREAM CodedOutputStream;
} // namespace io
} // namespace protobuf

View File

@ -19,11 +19,11 @@
#ifndef GRPCPP_IMPL_CREATE_AUTH_CONTEXT_H
#define GRPCPP_IMPL_CREATE_AUTH_CONTEXT_H
#include <memory>
#include <grpc/impl/grpc_types.h>
#include <grpcpp/security/auth_context.h>
#include <memory>
namespace grpc {
/// TODO(ctiller): not sure we want to make this a permanent thing

View File

@ -19,10 +19,10 @@
#ifndef GRPCPP_IMPL_DELEGATING_CHANNEL_H
#define GRPCPP_IMPL_DELEGATING_CHANNEL_H
#include <memory>
#include <grpcpp/impl/channel_interface.h>
#include <memory>
namespace grpc {
namespace experimental {

View File

@ -0,0 +1,93 @@
// Copyright 2024 gRPC 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
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef GRPCPP_IMPL_GENERIC_SERIALIZE_H
#define GRPCPP_IMPL_GENERIC_SERIALIZE_H
#include <grpc/byte_buffer_reader.h>
#include <grpc/impl/grpc_types.h>
#include <grpc/slice.h>
#include <grpcpp/impl/codegen/config_protobuf.h>
#include <grpcpp/impl/serialization_traits.h>
#include <grpcpp/support/byte_buffer.h>
#include <grpcpp/support/proto_buffer_reader.h>
#include <grpcpp/support/proto_buffer_writer.h>
#include <grpcpp/support/slice.h>
#include <grpcpp/support/status.h>
#include <type_traits>
#include "absl/log/absl_check.h"
/// This header provides serialization and deserialization between gRPC
/// messages serialized using protobuf and the C++ objects they represent.
namespace grpc {
// ProtoBufferWriter must be a subclass of ::protobuf::io::ZeroCopyOutputStream.
template <class ProtoBufferWriter, class T>
Status GenericSerialize(const grpc::protobuf::MessageLite& msg, ByteBuffer* bb,
bool* own_buffer) {
static_assert(std::is_base_of<protobuf::io::ZeroCopyOutputStream,
ProtoBufferWriter>::value,
"ProtoBufferWriter must be a subclass of "
"::protobuf::io::ZeroCopyOutputStream");
*own_buffer = true;
int byte_size = static_cast<int>(msg.ByteSizeLong());
if (static_cast<size_t>(byte_size) <= GRPC_SLICE_INLINED_SIZE) {
Slice slice(byte_size);
// We serialize directly into the allocated slices memory
ABSL_CHECK(slice.end() == msg.SerializeWithCachedSizesToArray(
const_cast<uint8_t*>(slice.begin())));
ByteBuffer tmp(&slice, 1);
bb->Swap(&tmp);
return grpc::Status::OK;
}
ProtoBufferWriter writer(bb, kProtoBufferWriterMaxBufferLength, byte_size);
protobuf::io::CodedOutputStream cs(&writer);
msg.SerializeWithCachedSizes(&cs);
return !cs.HadError()
? grpc::Status::OK
: Status(StatusCode::INTERNAL, "Failed to serialize message");
}
// BufferReader must be a subclass of ::protobuf::io::ZeroCopyInputStream.
template <class ProtoBufferReader, class T>
Status GenericDeserialize(ByteBuffer* buffer,
grpc::protobuf::MessageLite* msg) {
static_assert(std::is_base_of<protobuf::io::ZeroCopyInputStream,
ProtoBufferReader>::value,
"ProtoBufferReader must be a subclass of "
"::protobuf::io::ZeroCopyInputStream");
if (buffer == nullptr) {
return Status(StatusCode::INTERNAL, "No payload");
}
Status result = grpc::Status::OK;
{
ProtoBufferReader reader(buffer);
if (!reader.status().ok()) {
return reader.status();
}
if (!msg->ParseFromZeroCopyStream(&reader)) {
result = Status(StatusCode::INTERNAL, msg->InitializationErrorString());
}
}
buffer->Clear();
return result;
}
} // namespace grpc
#endif // GRPCPP_IMPL_GENERIC_SERIALIZE_H

View File

@ -19,8 +19,6 @@
#ifndef GRPCPP_IMPL_GENERIC_STUB_INTERNAL_H
#define GRPCPP_IMPL_GENERIC_STUB_INTERNAL_H
#include <functional>
#include <grpcpp/client_context.h>
#include <grpcpp/impl/rpc_method.h>
#include <grpcpp/support/byte_buffer.h>
@ -28,6 +26,8 @@
#include <grpcpp/support/status.h>
#include <grpcpp/support/stub_options.h>
#include <functional>
namespace grpc {
template <class RequestType, class ResponseType>

View File

@ -19,11 +19,11 @@
#ifndef GRPCPP_IMPL_GRPC_LIBRARY_H
#define GRPCPP_IMPL_GRPC_LIBRARY_H
#include <iostream>
#include <grpc/grpc.h>
#include <grpcpp/impl/codegen/config.h>
#include <iostream>
namespace grpc {
namespace internal {

View File

@ -19,19 +19,18 @@
#ifndef GRPCPP_IMPL_INTERCEPTOR_COMMON_H
#define GRPCPP_IMPL_INTERCEPTOR_COMMON_H
#include <array>
#include <functional>
#include "absl/log/absl_check.h"
#include <grpc/impl/grpc_types.h>
#include <grpc/support/log.h>
#include <grpcpp/impl/call.h>
#include <grpcpp/impl/call_op_set_interface.h>
#include <grpcpp/impl/intercepted_channel.h>
#include <grpcpp/support/client_interceptor.h>
#include <grpcpp/support/server_interceptor.h>
#include <array>
#include <functional>
#include "absl/log/absl_check.h"
namespace grpc {
namespace internal {

View File

@ -19,12 +19,11 @@
#ifndef GRPCPP_IMPL_METADATA_MAP_H
#define GRPCPP_IMPL_METADATA_MAP_H
#include <map>
#include <grpc/grpc.h>
#include <grpc/support/log.h>
#include <grpcpp/support/slice.h>
#include <map>
namespace grpc {
namespace internal {

View File

@ -19,15 +19,11 @@
#ifndef GRPCPP_IMPL_PROTO_UTILS_H
#define GRPCPP_IMPL_PROTO_UTILS_H
#include <type_traits>
#include "absl/log/absl_check.h"
#include <grpc/byte_buffer_reader.h>
#include <grpc/impl/grpc_types.h>
#include <grpc/slice.h>
#include <grpc/support/log.h>
#include <grpcpp/impl/codegen/config_protobuf.h>
#include <grpcpp/impl/generic_serialize.h>
#include <grpcpp/impl/serialization_traits.h>
#include <grpcpp/support/byte_buffer.h>
#include <grpcpp/support/proto_buffer_reader.h>
@ -35,65 +31,13 @@
#include <grpcpp/support/slice.h>
#include <grpcpp/support/status.h>
#include <type_traits>
/// This header provides serialization and deserialization between gRPC
/// messages serialized using protobuf and the C++ objects they represent.
namespace grpc {
// ProtoBufferWriter must be a subclass of ::protobuf::io::ZeroCopyOutputStream.
template <class ProtoBufferWriter, class T>
Status GenericSerialize(const grpc::protobuf::MessageLite& msg, ByteBuffer* bb,
bool* own_buffer) {
static_assert(std::is_base_of<protobuf::io::ZeroCopyOutputStream,
ProtoBufferWriter>::value,
"ProtoBufferWriter must be a subclass of "
"::protobuf::io::ZeroCopyOutputStream");
*own_buffer = true;
int byte_size = static_cast<int>(msg.ByteSizeLong());
if (static_cast<size_t>(byte_size) <= GRPC_SLICE_INLINED_SIZE) {
Slice slice(byte_size);
// We serialize directly into the allocated slices memory
ABSL_CHECK(slice.end() == msg.SerializeWithCachedSizesToArray(
const_cast<uint8_t*>(slice.begin())));
ByteBuffer tmp(&slice, 1);
bb->Swap(&tmp);
return grpc::Status::OK;
}
ProtoBufferWriter writer(bb, kProtoBufferWriterMaxBufferLength, byte_size);
return msg.SerializeToZeroCopyStream(&writer)
? grpc::Status::OK
: Status(StatusCode::INTERNAL, "Failed to serialize message");
}
// BufferReader must be a subclass of ::protobuf::io::ZeroCopyInputStream.
template <class ProtoBufferReader, class T>
Status GenericDeserialize(ByteBuffer* buffer,
grpc::protobuf::MessageLite* msg) {
static_assert(std::is_base_of<protobuf::io::ZeroCopyInputStream,
ProtoBufferReader>::value,
"ProtoBufferReader must be a subclass of "
"::protobuf::io::ZeroCopyInputStream");
if (buffer == nullptr) {
return Status(StatusCode::INTERNAL, "No payload");
}
Status result = grpc::Status::OK;
{
ProtoBufferReader reader(buffer);
if (!reader.status().ok()) {
return reader.status();
}
if (!msg->ParseFromZeroCopyStream(&reader)) {
result = Status(StatusCode::INTERNAL, msg->InitializationErrorString());
}
}
buffer->Clear();
return result;
}
// this is needed so the following class does not conflict with protobuf
// serializers that utilize internal-only tools.
#ifdef GRPC_OPEN_SOURCE_PROTO
// This class provides a protobuf serializer. It translates between protobuf
// objects and grpc_byte_buffers. More information about SerializationTraits can
// be found in include/grpcpp/impl/codegen/serialization_traits.h.
@ -112,7 +56,6 @@ class SerializationTraits<
return GenericDeserialize<ProtoBufferReader, T>(buffer, msg);
}
};
#endif
} // namespace grpc

View File

@ -19,10 +19,10 @@
#ifndef GRPCPP_IMPL_RPC_METHOD_H
#define GRPCPP_IMPL_RPC_METHOD_H
#include <memory>
#include <grpcpp/impl/codegen/channel_interface.h>
#include <memory>
namespace grpc {
namespace internal {
/// Descriptor of an RPC method

View File

@ -19,6 +19,11 @@
#ifndef GRPCPP_IMPL_RPC_SERVICE_METHOD_H
#define GRPCPP_IMPL_RPC_SERVICE_METHOD_H
#include <grpcpp/impl/rpc_method.h>
#include <grpcpp/support/byte_buffer.h>
#include <grpcpp/support/config.h>
#include <grpcpp/support/status.h>
#include <climits>
#include <functional>
#include <map>
@ -28,11 +33,6 @@
#include "absl/log/absl_check.h"
#include "absl/log/absl_log.h"
#include <grpcpp/impl/rpc_method.h>
#include <grpcpp/support/byte_buffer.h>
#include <grpcpp/support/config.h>
#include <grpcpp/support/status.h>
namespace grpc {
class ServerContextBase;
namespace internal {

View File

@ -19,12 +19,12 @@
#ifndef GRPCPP_IMPL_SERVER_BUILDER_OPTION_H
#define GRPCPP_IMPL_SERVER_BUILDER_OPTION_H
#include <map>
#include <memory>
#include <grpcpp/impl/server_builder_plugin.h>
#include <grpcpp/support/channel_arguments.h>
#include <map>
#include <memory>
namespace grpc {
/// Interface to pass an option to a \a ServerBuilder.

View File

@ -19,11 +19,11 @@
#ifndef GRPCPP_IMPL_SERVER_BUILDER_PLUGIN_H
#define GRPCPP_IMPL_SERVER_BUILDER_PLUGIN_H
#include <memory>
#include <grpcpp/support/channel_arguments.h>
#include <grpcpp/support/config.h>
#include <memory>
namespace grpc {
class ServerBuilder;

View File

@ -18,17 +18,16 @@
#ifndef GRPCPP_IMPL_SERVER_CALLBACK_HANDLERS_H
#define GRPCPP_IMPL_SERVER_CALLBACK_HANDLERS_H
#include "absl/log/absl_check.h"
#include <grpc/grpc.h>
#include <grpc/impl/call.h>
#include <grpc/support/log.h>
#include <grpcpp/impl/rpc_service_method.h>
#include <grpcpp/server_context.h>
#include <grpcpp/support/message_allocator.h>
#include <grpcpp/support/server_callback.h>
#include <grpcpp/support/status.h>
#include "absl/log/absl_check.h"
namespace grpc {
namespace internal {
@ -117,8 +116,8 @@ class CallbackUnaryHandler : public grpc::internal::MethodHandler {
// A callback that only contains a call to MaybeDone can be run as an
// inline callback regardless of whether or not OnDone is inlineable
// because if the actual OnDone callback needs to be scheduled, MaybeDone
// is responsible for dispatching to an executor thread if needed. Thus,
// when setting up the finish_tag_, we can set its own callback to
// is responsible for dispatching to an EventEngine thread if needed.
// Thus, when setting up the finish_tag_, we can set its own callback to
// inlineable.
finish_tag_.Set(
call_.call(),
@ -153,9 +152,9 @@ class CallbackUnaryHandler : public grpc::internal::MethodHandler {
this->Ref();
// The callback for this function should not be marked inline because it
// is directly invoking a user-controlled reaction
// (OnSendInitialMetadataDone). Thus it must be dispatched to an executor
// thread. However, any OnDone needed after that can be inlined because it
// is already running on an executor thread.
// (OnSendInitialMetadataDone). Thus it must be dispatched to an
// EventEngine thread. However, any OnDone needed after that can be
// inlined because it is already running on an EventEngine thread.
meta_tag_.Set(
call_.call(),
[this](bool ok) {
@ -341,7 +340,7 @@ class CallbackClientStreamingHandler : public grpc::internal::MethodHandler {
this->Ref();
// The callback for this function should not be inlined because it invokes
// a user-controlled reaction, but any resulting OnDone can be inlined in
// the executor to which this callback is dispatched.
// the EventEngine thread to which this callback is dispatched.
meta_tag_.Set(
call_.call(),
[this](bool ok) {
@ -381,7 +380,7 @@ class CallbackClientStreamingHandler : public grpc::internal::MethodHandler {
reactor_.store(reactor, std::memory_order_relaxed);
// The callback for this function should not be inlined because it invokes
// a user-controlled reaction, but any resulting OnDone can be inlined in
// the executor to which this callback is dispatched.
// the EventEngine thread to which this callback is dispatched.
read_tag_.Set(
call_.call(),
[this, reactor](bool ok) {
@ -545,7 +544,7 @@ class CallbackServerStreamingHandler : public grpc::internal::MethodHandler {
this->Ref();
// The callback for this function should not be inlined because it invokes
// a user-controlled reaction, but any resulting OnDone can be inlined in
// the executor to which this callback is dispatched.
// the EventEngine thread to which this callback is dispatched.
meta_tag_.Set(
call_.call(),
[this](bool ok) {
@ -608,7 +607,7 @@ class CallbackServerStreamingHandler : public grpc::internal::MethodHandler {
reactor_.store(reactor, std::memory_order_relaxed);
// The callback for this function should not be inlined because it invokes
// a user-controlled reaction, but any resulting OnDone can be inlined in
// the executor to which this callback is dispatched.
// the EventEngine thread to which this callback is dispatched.
write_tag_.Set(
call_.call(),
[this, reactor](bool ok) {
@ -757,7 +756,7 @@ class CallbackBidiHandler : public grpc::internal::MethodHandler {
this->Ref();
// The callback for this function should not be inlined because it invokes
// a user-controlled reaction, but any resulting OnDone can be inlined in
// the executor to which this callback is dispatched.
// the EventEngine thread to which this callback is dispatched.
meta_tag_.Set(
call_.call(),
[this](bool ok) {
@ -822,7 +821,7 @@ class CallbackBidiHandler : public grpc::internal::MethodHandler {
reactor_.store(reactor, std::memory_order_relaxed);
// The callbacks for these functions should not be inlined because they
// invoke user-controlled reactions, but any resulting OnDones can be
// inlined in the executor to which a callback is dispatched.
// inlined in the EventEngine thread to which a callback is dispatched.
write_tag_.Set(
call_.call(),
[this, reactor](bool ok) {

View File

@ -19,11 +19,11 @@
#ifndef GRPCPP_IMPL_SERVER_INITIALIZER_H
#define GRPCPP_IMPL_SERVER_INITIALIZER_H
#include <grpcpp/server.h>
#include <memory>
#include <vector>
#include <grpcpp/server.h>
namespace grpc {
class Server;
class Service;

View File

@ -19,15 +19,14 @@
#ifndef GRPCPP_IMPL_SERVICE_TYPE_H
#define GRPCPP_IMPL_SERVICE_TYPE_H
#include "absl/log/absl_check.h"
#include <grpc/support/log.h>
#include <grpcpp/impl/rpc_service_method.h>
#include <grpcpp/impl/serialization_traits.h>
#include <grpcpp/server_interface.h>
#include <grpcpp/support/config.h>
#include <grpcpp/support/status.h>
#include "absl/log/absl_check.h"
namespace grpc {
class CompletionQueue;

View File

@ -25,21 +25,20 @@
#include <pthread.h>
#endif
#include <grpc/support/sync.h>
#include <grpc/support/time.h>
#include <mutex>
#include "absl/log/absl_check.h"
#include "absl/synchronization/mutex.h"
#include <grpc/support/log.h>
#include <grpc/support/sync.h>
#include <grpc/support/time.h>
// The core library is not accessible in C++ codegen headers, and vice versa.
// Thus, we need to have duplicate headers with similar functionality.
// Make sure any change to this file is also reflected in
// src/core/lib/gprpp/sync.h too.
// src/core/util/sync.h too.
//
// Whenever possible, prefer "src/core/lib/gprpp/sync.h" over this file,
// Whenever possible, prefer "src/core/util/sync.h" over this file,
// since in core we do not rely on g_core_codegen_interface and hence do not
// pay the costs of virtual function calls.

View File

@ -0,0 +1,137 @@
/*
*
* Copyright 2025 gRPC 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
*
* 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.
*
* Protect Code from unwanted/inconvienet macros
* you must follow this pattern when #including port_def.inc in a header file:
*
* #include "other_header.h"
* #include "message.h"
* etc.
*
* #include "port_def.inc" // MUST be last header included
*
* Definitions for this header.
*
* #include "port_undef.inc" //At end of file
*
* This is a textual header with no include guard, because we want to
* detect/prohibit anytime it is #included twice without a corresponding
* #undef.
*/
#ifdef GRPC_PORT_
#error "port_def.inc included multiple times"
#endif
#define GRPC_PORT_
// Windows declares several inconvenient macro names. We #undef them and then
// restore them in port_undef.inc.
#ifdef _WIN32
#pragma push_macro("CompareString")
#undef CompareString
#pragma push_macro("CREATE_NEW")
#undef CREATE_NEW
#pragma push_macro("DELETE")
#undef DELETE
#pragma push_macro("DOUBLE_CLICK")
#undef DOUBLE_CLICK
#pragma push_macro("ERROR")
#undef ERROR
#pragma push_macro("ERROR_BUSY")
#undef ERROR_BUSY
#pragma push_macro("ERROR_INSTALL_FAILED")
#undef ERROR_INSTALL_FAILED
#pragma push_macro("ERROR_NOT_FOUND")
#undef ERROR_NOT_FOUND
#pragma push_macro("ERROR_RETRY")
#undef ERROR_RETRY
#pragma push_macro("ERROR_TIMEOUT")
#undef ERROR_TIMEOUT
#pragma push_macro("GetClassName")
#undef GetClassName
#pragma push_macro("GetCurrentTime")
#undef GetCurrentTime
#pragma push_macro("GetMessage")
#undef GetMessage
#pragma push_macro("GetObject")
#undef GetObject
#pragma push_macro("IGNORE")
#undef IGNORE
#pragma push_macro("IN")
#undef IN
#pragma push_macro("INPUT_KEYBOARD")
#undef INPUT_KEYBOARD
#pragma push_macro("NO_ERROR")
#undef NO_ERROR
#pragma push_macro("OUT")
#undef OUT
#pragma push_macro("OPTIONAL")
#undef OPTIONAL
#pragma push_macro("min")
#undef min
#pragma push_macro("max")
#undef max
#pragma push_macro("NEAR")
#undef NEAR
#pragma push_macro("NO_DATA")
#undef NO_DATA
#pragma push_macro("REASON_UNKNOWN")
#undef REASON_UNKNOWN
#pragma push_macro("SERVICE_DISABLED")
#undef SERVICE_DISABLED
#pragma push_macro("SERVICE_STOP")
#undef SERVICE_STOP
#pragma push_macro("SEVERITY_ERROR")
#undef SEVERITY_ERROR
#pragma push_macro("STATUS_PENDING")
#undef STATUS_PENDING
#pragma push_macro("STRICT")
#undef STRICT
#pragma push_macro("timezone")
#undef timezone
#pragma push_macro("TRUE")
#undef TRUE
#pragma push_macro("FALSE")
#undef FALSE
#pragma push_macro("UNICODE")
#undef UNICODE
#endif // _WIN32
#ifdef __APPLE__
// Inconvenient macro names from /usr/include/mach/boolean.h in some macOS SDKs.
#pragma push_macro("TRUE")
#undef TRUE
#pragma push_macro("FALSE")
#undef FALSE
// Inconvenient macro names from usr/include/sys/syslimits.h in some macOS SDKs.
#pragma push_macro("UID_MAX")
#undef UID_MAX
#pragma push_macro("GID_MAX")
#undef GID_MAX
// TYPE_BOOL is defined in the MacOS's ConditionalMacros.h.
#pragma push_macro("TYPE_BOOL")
#undef TYPE_BOOL
#endif // __APPLE__
#if defined(ANDROID) || defined(__ANDROID__)
// Inconvenient macro names from usr/include/limits.h in some Android NDKs.
#pragma push_macro("UID_MAX")
#undef UID_MAX
#pragma push_macro("GID_MAX")
#undef GID_MAX
#endif // defined(ANDROID) || defined(__ANDROID__)

View File

@ -0,0 +1,75 @@
/*
*
* Copyright 2025 gRPC 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
*
* 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.
*
* #undefs all macros defined in port_def.inc. See comments in port_def.inc
* for more info.
*/
#ifndef GRPC_PORT_
#error "port_undef.inc must be included after port_def.inc"
#endif
#undef GRPC_PORT_
#ifdef _WIN32
#pragma pop_macro("CompareString")
#pragma pop_macro("CREATE_NEW")
#pragma pop_macro("DELETE")
#pragma pop_macro("DOUBLE_CLICK")
#pragma pop_macro("ERROR")
#pragma pop_macro("ERROR_BUSY")
#pragma pop_macro("ERROR_INSTALL_FAILED")
#pragma pop_macro("ERROR_NOT_FOUND")
#pragma pop_macro("ERROR_RETRY")
#pragma pop_macro("ERROR_TIMEOUT")
#pragma pop_macro("GetClassName")
#pragma pop_macro("GetCurrentTime")
#pragma pop_macro("GetMessage")
#pragma pop_macro("GetObject")
#pragma pop_macro("IGNORE")
#pragma pop_macro("IN")
#pragma pop_macro("INPUT_KEYBOARD")
#pragma pop_macro("NO_ERROR")
#pragma pop_macro("OUT")
#pragma pop_macro("OPTIONAL")
#pragma pop_macro("min")
#pragma pop_macro("max")
#pragma pop_macro("NEAR")
#pragma pop_macro("NO_DATA")
#pragma pop_macro("REASON_UNKNOWN")
#pragma pop_macro("SERVICE_DISABLED")
#pragma pop_macro("SERVICE_STOP")
#pragma pop_macro("SEVERITY_ERROR")
#pragma pop_macro("STRICT")
#pragma pop_macro("STATUS_PENDING")
#pragma pop_macro("timezone")
#pragma pop_macro("TRUE")
#pragma pop_macro("FALSE")
#pragma pop_macro("UNICODE")
#endif
#ifdef __APPLE__
#pragma pop_macro("TRUE")
#pragma pop_macro("FALSE")
#pragma pop_macro("UID_MAX")
#pragma pop_macro("GID_MAX")
#pragma pop_macro("TYPE_BOOL")
#endif // __APPLE__
#if defined(ANDROID) || defined(__ANDROID__)
#pragma pop_macro("UID_MAX")
#pragma pop_macro("GID_MAX")
#endif // defined(ANDROID) || defined(__ANDROID__)

View File

@ -19,15 +19,15 @@
#ifndef GRPCPP_SECURITY_AUDIT_LOGGING_H
#define GRPCPP_SECURITY_AUDIT_LOGGING_H
#include <grpc/grpc_audit_logging.h>
#include <grpcpp/support/string_ref.h>
#include <memory>
#include <string>
#include <utility>
#include "absl/status/statusor.h"
#include <grpc/grpc_audit_logging.h>
#include <grpcpp/support/string_ref.h>
namespace grpc {
namespace experimental {

View File

@ -19,12 +19,12 @@
#ifndef GRPCPP_SECURITY_AUTH_CONTEXT_H
#define GRPCPP_SECURITY_AUTH_CONTEXT_H
#include <iterator>
#include <vector>
#include <grpcpp/support/config.h>
#include <grpcpp/support/string_ref.h>
#include <iterator>
#include <vector>
struct grpc_auth_context;
struct grpc_auth_property;
struct grpc_auth_property_iterator;

View File

@ -19,12 +19,12 @@
#ifndef GRPCPP_SECURITY_AUTH_METADATA_PROCESSOR_H
#define GRPCPP_SECURITY_AUTH_METADATA_PROCESSOR_H
#include <map>
#include <grpcpp/security/auth_context.h>
#include <grpcpp/support/status.h>
#include <grpcpp/support/string_ref.h>
#include <map>
namespace grpc {
/// Interface allowing custom server-side authorization based on credentials

View File

@ -15,11 +15,11 @@
#ifndef GRPCPP_SECURITY_AUTHORIZATION_POLICY_PROVIDER_H
#define GRPCPP_SECURITY_AUTHORIZATION_POLICY_PROVIDER_H
#include <memory>
#include <grpc/grpc_security.h>
#include <grpc/status.h>
#include <grpcpp/impl/codegen/status.h>
#include <grpcpp/support/status.h>
#include <memory>
namespace grpc {
namespace experimental {

View File

@ -1,43 +0,0 @@
// Copyright 2021 gRPC 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
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef GRPCPP_SECURITY_BINDER_CREDENTIALS_H
#define GRPCPP_SECURITY_BINDER_CREDENTIALS_H
#include <memory>
#include <grpcpp/security/binder_security_policy.h>
#include <grpcpp/security/server_credentials.h>
namespace grpc {
class ChannelCredentials;
namespace experimental {
/// EXPERIMENTAL Builds Binder ServerCredentials.
///
/// This should be used along with `binder:` URI scheme. The path in the URI can
/// later be used to access the server's endpoint binder.
/// Note that calling \a ServerBuilder::AddListeningPort() with Binder
/// ServerCredentials in a non-supported environment will make the subsequent
/// call to \a ServerBuilder::BuildAndStart() return a null pointer.
std::shared_ptr<grpc::ServerCredentials> BinderServerCredentials(
std::shared_ptr<grpc::experimental::binder::SecurityPolicy>
security_policy);
} // namespace experimental
} // namespace grpc
#endif // GRPCPP_SECURITY_BINDER_CREDENTIALS_H

View File

@ -1,82 +0,0 @@
// Copyright 2021 gRPC 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
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef GRPCPP_SECURITY_BINDER_SECURITY_POLICY_H
#define GRPCPP_SECURITY_BINDER_SECURITY_POLICY_H
#include <memory>
#ifdef GPR_ANDROID
#include <jni.h>
#endif
namespace grpc {
namespace experimental {
namespace binder {
// EXPERIMENTAL Determinines if a connection is allowed to be
// established on Android. See https://source.android.com/security/app-sandbox
// for more info about UID.
class SecurityPolicy {
public:
virtual ~SecurityPolicy() = default;
// Returns true if the UID is authorized to connect.
// Must return the same value for the same inputs so callers can safely cache
// the result.
virtual bool IsAuthorized(int uid) = 0;
};
// EXPERIMENTAL Allows all connection. Anything on the Android device will be
// able to connect, use with caution!
class UntrustedSecurityPolicy : public SecurityPolicy {
public:
UntrustedSecurityPolicy();
~UntrustedSecurityPolicy() override;
bool IsAuthorized(int uid) override;
};
// EXPERIMENTAL Only allows the connections from processes with the same UID. In
// most cases this means "from the same APK".
class InternalOnlySecurityPolicy : public SecurityPolicy {
public:
InternalOnlySecurityPolicy();
~InternalOnlySecurityPolicy() override;
bool IsAuthorized(int uid) override;
};
#ifdef GPR_ANDROID
// EXPERIMENTAL Only allows the connections from the APK that have the same
// signature.
class SameSignatureSecurityPolicy : public SecurityPolicy {
public:
// `context` is required for getting PackageManager Java class
SameSignatureSecurityPolicy(JavaVM* jvm, jobject context);
~SameSignatureSecurityPolicy() override;
bool IsAuthorized(int uid) override;
private:
JavaVM* jvm_;
jobject context_;
};
#endif
} // namespace binder
} // namespace experimental
} // namespace grpc
#endif // GRPCPP_SECURITY_BINDER_SECURITY_POLICY_H

View File

@ -19,10 +19,6 @@
#ifndef GRPCPP_SECURITY_CREDENTIALS_H
#define GRPCPP_SECURITY_CREDENTIALS_H
#include <map>
#include <memory>
#include <vector>
#include <grpc/grpc_security_constants.h>
#include <grpcpp/channel.h>
#include <grpcpp/impl/grpc_library.h>
@ -33,6 +29,10 @@
#include <grpcpp/support/status.h>
#include <grpcpp/support/string_ref.h>
#include <map>
#include <memory>
#include <vector>
struct grpc_call;
namespace grpc {
@ -247,7 +247,7 @@ class MetadataCredentialsPlugin {
/// Type of credentials this plugin is implementing.
virtual const char* GetType() const { return ""; }
/// Gets the auth metatada produced by this plugin.
/// Gets the auth metadata produced by this plugin.
/// The fully qualified method name is:
/// service_url + "/" + method_name.
/// The channel_auth_context contains (among other things), the identity of
@ -295,7 +295,7 @@ grpc::Status StsCredentialsOptionsFromJson(const std::string& json_string,
/// Creates STS credentials options from the $STS_CREDENTIALS environment
/// variable. This environment variable points to the path of a JSON file
/// comforming to the schema described above.
/// conforming to the schema described above.
grpc::Status StsCredentialsOptionsFromEnv(StsCredentialsOptions* options);
std::shared_ptr<CallCredentials> StsCredentials(

View File

@ -19,15 +19,15 @@
#ifndef GRPCPP_SECURITY_SERVER_CREDENTIALS_H
#define GRPCPP_SECURITY_SERVER_CREDENTIALS_H
#include <memory>
#include <vector>
#include <grpc/grpc_security_constants.h>
#include <grpcpp/impl/grpc_library.h>
#include <grpcpp/security/auth_metadata_processor.h>
#include <grpcpp/security/tls_credentials_options.h>
#include <grpcpp/support/config.h>
#include <memory>
#include <vector>
struct grpc_server;
namespace grpc {
@ -116,9 +116,6 @@ std::shared_ptr<ServerCredentials> AltsServerCredentials(
const AltsServerCredentialsOptions& options);
/// Builds Local ServerCredentials.
std::shared_ptr<ServerCredentials> AltsServerCredentials(
const AltsServerCredentialsOptions& options);
std::shared_ptr<ServerCredentials> LocalServerCredentials(
grpc_local_connect_type type);

View File

@ -17,16 +17,19 @@
#ifndef GRPCPP_SECURITY_TLS_CERTIFICATE_PROVIDER_H
#define GRPCPP_SECURITY_TLS_CERTIFICATE_PROVIDER_H
#include <memory>
#include <vector>
#include <grpc/credentials.h>
#include <grpc/grpc_security.h>
#include <grpc/grpc_security_constants.h>
#include <grpc/status.h>
#include <grpc/support/log.h>
#include <grpc/support/port_platform.h>
#include <grpcpp/support/config.h>
#include <memory>
#include <string>
#include <vector>
#include "absl/status/statusor.h"
namespace grpc {
namespace experimental {
@ -68,6 +71,12 @@ class GRPCXX_DLL StaticDataCertificateProvider
grpc_tls_certificate_provider* c_provider() override { return c_provider_; }
// Returns an OK status if the following conditions hold:
// - the root certificates consist of one or more valid PEM blocks, and
// - every identity key-cert pair has a certificate chain that consists of
// valid PEM blocks and has a private key is a valid PEM block.
absl::Status ValidateCredentials() const;
private:
grpc_tls_certificate_provider* c_provider_ = nullptr;
};
@ -118,6 +127,14 @@ class GRPCXX_DLL FileWatcherCertificateProvider final
grpc_tls_certificate_provider* c_provider() override { return c_provider_; }
// Returns an OK status if the following conditions hold:
// - the currently-loaded root certificates, if any, consist of one or more
// valid PEM blocks, and
// - every currently-loaded identity key-cert pair, if any, has a certificate
// chain that consists of valid PEM blocks and has a private key is a valid
// PEM block.
absl::Status ValidateCredentials() const;
private:
grpc_tls_certificate_provider* c_provider_ = nullptr;
};

View File

@ -17,21 +17,20 @@
#ifndef GRPCPP_SECURITY_TLS_CERTIFICATE_VERIFIER_H
#define GRPCPP_SECURITY_TLS_CERTIFICATE_VERIFIER_H
#include <functional>
#include <map>
#include <memory>
#include <utility>
#include <vector>
#include <grpc/grpc_security_constants.h>
#include <grpc/status.h>
#include <grpc/support/log.h>
#include <grpcpp/impl/grpc_library.h>
#include <grpcpp/impl/sync.h>
#include <grpcpp/support/config.h>
#include <grpcpp/support/status.h>
#include <grpcpp/support/string_ref.h>
#include <functional>
#include <map>
#include <memory>
#include <utility>
#include <vector>
// TODO(yihuazhang): remove the forward declaration here and include
// <grpc/grpc_security.h> directly once the insecure builds are cleaned up.
typedef struct grpc_tls_custom_verification_check_request

View File

@ -19,18 +19,17 @@
#ifndef GRPCPP_SECURITY_TLS_CREDENTIALS_OPTIONS_H
#define GRPCPP_SECURITY_TLS_CREDENTIALS_OPTIONS_H
#include <memory>
#include <vector>
#include <grpc/grpc_security.h>
#include <grpc/grpc_security_constants.h>
#include <grpc/status.h>
#include <grpc/support/log.h>
#include <grpcpp/security/tls_certificate_provider.h>
#include <grpcpp/security/tls_certificate_verifier.h>
#include <grpcpp/security/tls_crl_provider.h>
#include <grpcpp/support/config.h>
#include <memory>
#include <vector>
namespace grpc {
namespace experimental {

View File

@ -19,10 +19,6 @@
#ifndef GRPCPP_SERVER_H
#define GRPCPP_SERVER_H
#include <list>
#include <memory>
#include <vector>
#include <grpc/compression.h>
#include <grpc/support/atm.h>
#include <grpc/support/port_platform.h>
@ -39,6 +35,10 @@
#include <grpcpp/support/config.h>
#include <grpcpp/support/status.h>
#include <list>
#include <memory>
#include <vector>
struct grpc_server;
namespace grpc {

View File

@ -19,11 +19,6 @@
#ifndef GRPCPP_SERVER_BUILDER_H
#define GRPCPP_SERVER_BUILDER_H
#include <climits>
#include <map>
#include <memory>
#include <vector>
#include <grpc/compression.h>
#include <grpc/event_engine/event_engine.h>
#include <grpc/passive_listener.h>
@ -40,6 +35,11 @@
#include <grpcpp/support/config.h>
#include <grpcpp/support/server_interceptor.h>
#include <climits>
#include <map>
#include <memory>
#include <vector>
struct grpc_resource_quota;
namespace grpc {
@ -297,7 +297,7 @@ class ServerBuilder {
// Creates a passive listener for Server Endpoint injection.
///
/// \a PasiveListener lets applications provide pre-established connections
/// \a PassiveListener lets applications provide pre-established connections
/// to gRPC Servers. The server will behave as if it accepted the connection
/// itself on its own listening addresses.
///

View File

@ -19,13 +19,6 @@
#ifndef GRPCPP_SERVER_CONTEXT_H
#define GRPCPP_SERVER_CONTEXT_H
#include <atomic>
#include <cassert>
#include <map>
#include <memory>
#include <type_traits>
#include <vector>
#include <grpc/grpc.h>
#include <grpc/impl/call.h>
#include <grpc/impl/compression_types.h>
@ -47,6 +40,13 @@
#include <grpcpp/support/string_ref.h>
#include <grpcpp/support/time.h>
#include <atomic>
#include <cassert>
#include <map>
#include <memory>
#include <type_traits>
#include <vector>
struct grpc_metadata;
struct grpc_call;
struct census_context;
@ -501,9 +501,9 @@ class ServerContextBase {
void OnCancel() override {}
void OnDone() override {}
// Override InternalInlineable for this class since its reactions are
// trivial and thus do not need to be run from the executor (triggering a
// thread hop). This should only be used by internal reactors (thus the
// name) and not by user application code.
// trivial and thus do not need to be run from the EventEngine (potentially
// triggering a thread hop). This should only be used by internal reactors
// (thus the name) and not by user application code.
bool InternalInlineable() override { return true; }
};

View File

@ -19,11 +19,8 @@
#ifndef GRPCPP_SERVER_INTERFACE_H
#define GRPCPP_SERVER_INTERFACE_H
#include "absl/log/absl_check.h"
#include <grpc/grpc.h>
#include <grpc/impl/grpc_types.h>
#include <grpc/support/log.h>
#include <grpc/support/port_platform.h>
#include <grpc/support/time.h>
#include <grpcpp/impl/call.h>
@ -34,6 +31,8 @@
#include <grpcpp/server_context.h>
#include <grpcpp/support/byte_buffer.h>
#include "absl/log/absl_check.h"
namespace grpc {
class AsyncGenericService;

View File

@ -19,11 +19,11 @@
#ifndef GRPCPP_SERVER_POSIX_H
#define GRPCPP_SERVER_POSIX_H
#include <memory>
#include <grpc/support/port_platform.h>
#include <grpcpp/server.h>
#include <memory>
namespace grpc {
#ifdef GPR_SUPPORT_CHANNELS_FROM_FD

View File

@ -19,16 +19,15 @@
#ifndef GRPCPP_SUPPORT_ASYNC_STREAM_H
#define GRPCPP_SUPPORT_ASYNC_STREAM_H
#include "absl/log/absl_check.h"
#include <grpc/grpc.h>
#include <grpc/support/log.h>
#include <grpcpp/impl/call.h>
#include <grpcpp/impl/channel_interface.h>
#include <grpcpp/impl/service_type.h>
#include <grpcpp/server_context.h>
#include <grpcpp/support/status.h>
#include "absl/log/absl_check.h"
namespace grpc {
namespace internal {
@ -39,7 +38,11 @@ class ClientAsyncStreamingInterface {
/// Start the call that was set up by the constructor, but only if the
/// constructor was invoked through the "Prepare" API which doesn't actually
/// start the call
/// start the call.
///
/// It is illegal to start a write-type operation (eg. Write(), WriteLast(),
/// WritesDone()) while the `StartCall()` operation has not finished
/// (determined by the returning of \a tag).
virtual void StartCall(void* tag) = 0;
/// Request notification of the reading of the initial metadata. Completion

View File

@ -19,10 +19,7 @@
#ifndef GRPCPP_SUPPORT_ASYNC_UNARY_CALL_H
#define GRPCPP_SUPPORT_ASYNC_UNARY_CALL_H
#include "absl/log/absl_check.h"
#include <grpc/grpc.h>
#include <grpc/support/log.h>
#include <grpcpp/client_context.h>
#include <grpcpp/impl/call.h>
#include <grpcpp/impl/call_op_set.h>
@ -32,6 +29,8 @@
#include <grpcpp/server_context.h>
#include <grpcpp/support/status.h>
#include "absl/log/absl_check.h"
namespace grpc {
// Forward declaration for use in Helper class

View File

@ -19,16 +19,15 @@
#ifndef GRPCPP_SUPPORT_BYTE_BUFFER_H
#define GRPCPP_SUPPORT_BYTE_BUFFER_H
#include <vector>
#include <grpc/byte_buffer.h>
#include <grpc/grpc.h>
#include <grpc/support/log.h>
#include <grpcpp/impl/serialization_traits.h>
#include <grpcpp/support/config.h>
#include <grpcpp/support/slice.h>
#include <grpcpp/support/status.h>
#include <vector>
namespace grpc {
class ServerInterface;
@ -59,7 +58,7 @@ class GrpcByteBufferPeer;
/// A sequence of bytes.
class ByteBuffer final {
public:
/// Constuct an empty buffer.
/// Construct an empty buffer.
ByteBuffer() : buffer_(nullptr) {}
/// Construct buffer from \a slices, of which there are \a nslices.

View File

@ -19,19 +19,19 @@
#ifndef GRPCPP_SUPPORT_CALLBACK_COMMON_H
#define GRPCPP_SUPPORT_CALLBACK_COMMON_H
#include <functional>
#include "absl/log/absl_check.h"
#include <grpc/grpc.h>
#include <grpc/impl/grpc_types.h>
#include <grpc/support/log.h>
#include <grpcpp/impl/call.h>
#include <grpcpp/impl/codegen/channel_interface.h>
#include <grpcpp/impl/completion_queue_tag.h>
#include <grpcpp/support/config.h>
#include <grpcpp/support/global_callback_hook.h>
#include <grpcpp/support/status.h>
#include <functional>
#include "absl/log/absl_check.h"
namespace grpc {
namespace internal {
@ -127,7 +127,18 @@ class CallbackWithStatusTag : public grpc_completion_queue_functor {
auto status = std::move(status_);
func_ = nullptr; // reset to clear this out for sure
status_ = Status(); // reset to clear this out for sure
CatchingCallback(std::move(func), std::move(status));
GetGlobalCallbackHook()->RunCallback(
call_, [func = std::move(func), status = std::move(status)]() {
#if GRPC_ALLOW_EXCEPTIONS
try {
func(status);
} catch (...) {
// nothing to return or change here, just don't crash the library
}
#else // GRPC_ALLOW_EXCEPTIONS
func(status);
#endif // GRPC_ALLOW_EXCEPTIONS
});
grpc_call_unref(call_);
}
};
@ -214,7 +225,17 @@ class CallbackWithSuccessTag : public grpc_completion_queue_functor {
#endif
if (do_callback) {
CatchingCallback(func_, ok);
GetGlobalCallbackHook()->RunCallback(call_, [this, ok]() {
#if GRPC_ALLOW_EXCEPTIONS
try {
func_(ok);
} catch (...) {
// nothing to return or change here, just don't crash the library
}
#else // GRPC_ALLOW_EXCEPTIONS
func_(ok);
#endif // GRPC_ALLOW_EXCEPTIONS
});
}
}
};

View File

@ -19,14 +19,14 @@
#ifndef GRPCPP_SUPPORT_CHANNEL_ARGUMENTS_H
#define GRPCPP_SUPPORT_CHANNEL_ARGUMENTS_H
#include <list>
#include <vector>
#include <grpc/compression.h>
#include <grpc/grpc.h>
#include <grpcpp/resource_quota.h>
#include <grpcpp/support/config.h>
#include <list>
#include <vector>
namespace grpc {
class ChannelCredentials;
namespace testing {
@ -84,8 +84,10 @@ class ChannelArguments {
void SetMaxSendMessageSize(int size);
/// Set LB policy name.
/// Note that if the name resolver returns only balancer addresses, the
/// grpclb LB policy will be used, regardless of what is specified here.
/// Note that this API implicitly provides an empty config for the
/// specified LB policy, so it cannot be used for any policy with
/// required configuration parameters. For those cases, set the LB
/// policy via the service config instead.
void SetLoadBalancingPolicyName(const std::string& lb_policy_name);
/// Set service config in JSON form.

View File

@ -19,14 +19,8 @@
#ifndef GRPCPP_SUPPORT_CLIENT_CALLBACK_H
#define GRPCPP_SUPPORT_CLIENT_CALLBACK_H
#include <atomic>
#include <functional>
#include "absl/log/absl_check.h"
#include <grpc/grpc.h>
#include <grpc/impl/call.h>
#include <grpc/support/log.h>
#include <grpcpp/impl/call.h>
#include <grpcpp/impl/call_op_set.h>
#include <grpcpp/impl/sync.h>
@ -34,6 +28,11 @@
#include <grpcpp/support/config.h>
#include <grpcpp/support/status.h>
#include <atomic>
#include <functional>
#include "absl/log/absl_check.h"
namespace grpc {
class Channel;
class ClientContext;
@ -317,6 +316,10 @@ class ClientBidiReactor : public internal::ClientReactor {
/// all cases. If it is not called, it indicates an application-level problem
/// (like failure to remove a hold).
///
/// OnDone is called exactly once, and not concurrently with any (other)
/// reaction. (Holds may be needed (see above) to prevent OnDone from being
/// called concurrently with calls to the reactor from outside of reactions.)
///
/// \param[in] s The status outcome of this RPC
void OnDone(const grpc::Status& /*s*/) override {}
@ -326,21 +329,20 @@ class ClientBidiReactor : public internal::ClientReactor {
/// call of OnReadDone or OnDone.
///
/// \param[in] ok Was the initial metadata read successfully? If false, no
/// new read/write operation will succeed, and any further
/// Start* operations should not be called.
/// new read/write operation will succeed.
virtual void OnReadInitialMetadataDone(bool /*ok*/) {}
/// Notifies the application that a StartRead operation completed.
///
/// \param[in] ok Was it successful? If false, no new read/write operation
/// will succeed, and any further Start* should not be called.
/// will succeed.
virtual void OnReadDone(bool /*ok*/) {}
/// Notifies the application that a StartWrite or StartWriteLast operation
/// completed.
///
/// \param[in] ok Was it successful? If false, no new read/write operation
/// will succeed, and any further Start* should not be called.
/// will succeed.
virtual void OnWriteDone(bool /*ok*/) {}
/// Notifies the application that a StartWritesDone operation completed. Note
@ -634,8 +636,8 @@ class ClientCallbackReaderWriterImpl
// like StartCall or RemoveHold. If this is the last operation or hold on this
// object, it will invoke the OnDone reaction. If MaybeFinish was called from
// a reaction, it can call OnDone directly. If not, it would need to schedule
// OnDone onto an executor thread to avoid the possibility of deadlocking with
// any locks in the user code that invoked it.
// OnDone onto an EventEngine thread to avoid the possibility of deadlocking
// with any locks in the user code that invoked it.
void MaybeFinish(bool from_reaction) {
if (GPR_UNLIKELY(callbacks_outstanding_.fetch_sub(
1, std::memory_order_acq_rel) == 1)) {

View File

@ -19,16 +19,15 @@
#ifndef GRPCPP_SUPPORT_CLIENT_INTERCEPTOR_H
#define GRPCPP_SUPPORT_CLIENT_INTERCEPTOR_H
#include <grpcpp/impl/rpc_method.h>
#include <grpcpp/support/interceptor.h>
#include <grpcpp/support/string_ref.h>
#include <memory>
#include <vector>
#include "absl/log/absl_check.h"
#include <grpc/support/log.h>
#include <grpcpp/impl/rpc_method.h>
#include <grpcpp/support/interceptor.h>
#include <grpcpp/support/string_ref.h>
namespace grpc {
class Channel;

View File

@ -35,7 +35,7 @@ namespace grpc {
// Using grpc::string and grpc::to_string is discouraged in favor of
// std::string and std::to_string. This is only for legacy code using
// them explictly.
// them explicitly.
using std::string; // deprecated // NOLINT(misc-unused-using-decls)
using std::to_string; // deprecated // NOLINT(misc-unused-using-decls)

View File

@ -0,0 +1,58 @@
// Copyright 2024 gRPC 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
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef GRPCPP_SUPPORT_GLOBAL_CALLBACK_HOOK_H
#define GRPCPP_SUPPORT_GLOBAL_CALLBACK_HOOK_H
#include "absl/functional/function_ref.h"
struct grpc_call;
namespace grpc {
class GlobalCallbackHook {
public:
virtual ~GlobalCallbackHook() = default;
virtual void RunCallback(grpc_call* call,
absl::FunctionRef<void()> callback) = 0;
protected:
// An exception-safe way of invoking a user-specified callback function.
template <class Func, class... Args>
void CatchingCallback(Func&& func, Args&&... args) {
#if GRPC_ALLOW_EXCEPTIONS
try {
func(std::forward<Args>(args)...);
} catch (...) {
// nothing to return or change here, just don't crash the library
}
#else // GRPC_ALLOW_EXCEPTIONS
func(std::forward<Args>(args)...);
#endif // GRPC_ALLOW_EXCEPTIONS
}
};
class DefaultGlobalCallbackHook final : public GlobalCallbackHook {
public:
void RunCallback(grpc_call* call,
absl::FunctionRef<void()> callback) override {
CatchingCallback(callback);
}
};
std::shared_ptr<GlobalCallbackHook> GetGlobalCallbackHook();
void SetGlobalCallbackHook(GlobalCallbackHook* hook);
} // namespace grpc
#endif // GRPCPP_SUPPORT_GLOBAL_CALLBACK_HOOK_H

View File

@ -19,16 +19,16 @@
#ifndef GRPCPP_SUPPORT_INTERCEPTOR_H
#define GRPCPP_SUPPORT_INTERCEPTOR_H
#include <map>
#include <memory>
#include <string>
#include <grpc/impl/grpc_types.h>
#include <grpcpp/impl/metadata_map.h>
#include <grpcpp/support/byte_buffer.h>
#include <grpcpp/support/config.h>
#include <grpcpp/support/string_ref.h>
#include <map>
#include <memory>
#include <string>
namespace grpc {
class ChannelInterface;
@ -133,7 +133,7 @@ class InterceptorBatchMethods {
/// means that the payload would be available in the serialized form only
/// unless an interceptor replaces the payload with ModifySendMessage.
/// Returns a modifable ByteBuffer holding the serialized form of the message
/// Returns a modifiable ByteBuffer holding the serialized form of the message
/// that is going to be sent. Valid for PRE_SEND_MESSAGE interceptions.
/// A return value of nullptr indicates that this ByteBuffer is not valid.
virtual ByteBuffer* GetSerializedSendMessage() = 0;

Some files were not shown because too many files have changed in this diff Show More