transport_security_grpc.cc
Go to the documentation of this file.
1 /*
2  *
3  * Copyright 2017 gRPC authors.
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  */
18 
20 
22 
23 /* This method creates a tsi_zero_copy_grpc_protector object. */
25  const tsi_handshaker_result* self, size_t* max_output_protected_frame_size,
26  tsi_zero_copy_grpc_protector** protector) {
27  if (self == nullptr || self->vtable == nullptr || protector == nullptr) {
28  return TSI_INVALID_ARGUMENT;
29  }
30  if (self->vtable->create_zero_copy_grpc_protector == nullptr) {
31  return TSI_UNIMPLEMENTED;
32  }
33  return self->vtable->create_zero_copy_grpc_protector(
34  self, max_output_protected_frame_size, protector);
35 }
36 
37 /* --- tsi_zero_copy_grpc_protector common implementation. ---
38 
39  Calls specific implementation after state/input validation. */
40 
42  tsi_zero_copy_grpc_protector* self, grpc_slice_buffer* unprotected_slices,
43  grpc_slice_buffer* protected_slices) {
44  if (self == nullptr || self->vtable == nullptr ||
45  unprotected_slices == nullptr || protected_slices == nullptr) {
46  return TSI_INVALID_ARGUMENT;
47  }
48  if (self->vtable->protect == nullptr) return TSI_UNIMPLEMENTED;
49  return self->vtable->protect(self, unprotected_slices, protected_slices);
50 }
51 
53  tsi_zero_copy_grpc_protector* self, grpc_slice_buffer* protected_slices,
54  grpc_slice_buffer* unprotected_slices, int* min_progress_size) {
55  if (self == nullptr || self->vtable == nullptr ||
56  protected_slices == nullptr || unprotected_slices == nullptr) {
57  return TSI_INVALID_ARGUMENT;
58  }
59  if (self->vtable->unprotect == nullptr) return TSI_UNIMPLEMENTED;
60  return self->vtable->unprotect(self, protected_slices, unprotected_slices,
61  min_progress_size);
62 }
63 
65  if (self == nullptr) return;
66  self->vtable->destroy(self);
67 }
68 
70  tsi_zero_copy_grpc_protector* self, size_t* max_frame_size) {
71  if (self == nullptr || max_frame_size == nullptr) return TSI_INVALID_ARGUMENT;
72  if (self->vtable->max_frame_size == nullptr) return TSI_UNIMPLEMENTED;
73  return self->vtable->max_frame_size(self, max_frame_size);
74 }
tsi_zero_copy_grpc_protector_unprotect
tsi_result tsi_zero_copy_grpc_protector_unprotect(tsi_zero_copy_grpc_protector *self, grpc_slice_buffer *protected_slices, grpc_slice_buffer *unprotected_slices, int *min_progress_size)
Definition: transport_security_grpc.cc:52
tsi_zero_copy_grpc_protector_destroy
void tsi_zero_copy_grpc_protector_destroy(tsi_zero_copy_grpc_protector *self)
Definition: transport_security_grpc.cc:64
tsi_zero_copy_grpc_protector_protect
tsi_result tsi_zero_copy_grpc_protector_protect(tsi_zero_copy_grpc_protector *self, grpc_slice_buffer *unprotected_slices, grpc_slice_buffer *protected_slices)
Definition: transport_security_grpc.cc:41
tsi_handshaker_result_create_zero_copy_grpc_protector
tsi_result tsi_handshaker_result_create_zero_copy_grpc_protector(const tsi_handshaker_result *self, size_t *max_output_protected_frame_size, tsi_zero_copy_grpc_protector **protector)
Definition: transport_security_grpc.cc:24
tsi_result
tsi_result
Definition: transport_security_interface.h:31
TSI_UNIMPLEMENTED
@ TSI_UNIMPLEMENTED
Definition: transport_security_interface.h:38
TSI_INVALID_ARGUMENT
@ TSI_INVALID_ARGUMENT
Definition: transport_security_interface.h:34
tsi_handshaker_result
Definition: transport_security.h:121
tsi_zero_copy_grpc_protector_max_frame_size
tsi_result tsi_zero_copy_grpc_protector_max_frame_size(tsi_zero_copy_grpc_protector *self, size_t *max_frame_size)
Definition: transport_security_grpc.cc:69
grpc_slice_buffer
Definition: include/grpc/impl/codegen/slice.h:83
tsi_zero_copy_grpc_protector
Definition: transport_security_grpc.h:79
self
PHP_PROTO_OBJECT_FREE_END PHP_PROTO_OBJECT_DTOR_END intern self
Definition: bloaty/third_party/protobuf/php/ext/google/protobuf/map.c:543
transport_security_grpc.h
port_platform.h


grpc
Author(s):
autogenerated on Fri May 16 2025 03:00:40