alts_tsi_utils_test.cc
Go to the documentation of this file.
1 /*
2  *
3  * Copyright 2018 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 
21 #include "upb/upb.hpp"
22 
25 
26 #define ALTS_TSI_UTILS_TEST_OUT_FRAME "Hello Google"
27 
40 }
41 
47  size_t buf_len;
48  char* buf = grpc_gcp_HandshakerResp_serialize(resp, arena.ptr(), &buf_len);
50 
51  /* Valid serialization. */
52  upb::Arena arena2;
54  grpc_raw_byte_buffer_create(&slice, 1 /* number of slices */);
55  grpc_gcp_HandshakerResp* decoded_resp =
59 
60  /* Invalid serialization. */
61  grpc_slice bad_slice =
63  buffer = grpc_raw_byte_buffer_create(&bad_slice, 1 /* number of slices */);
65  nullptr);
66 
67  /* Clean up. */
69  grpc_slice_unref(bad_slice);
71 }
72 
73 int main(int argc, char** argv) {
75  /* Tests. */
76  grpc_init();
79  grpc_shutdown();
80  return 0;
81 }
grpc_slice_unref
GPRAPI void grpc_slice_unref(grpc_slice s)
Definition: slice_api.cc:32
grpc_raw_byte_buffer_create
GRPCAPI grpc_byte_buffer * grpc_raw_byte_buffer_create(grpc_slice *slices, size_t nslices)
Definition: byte_buffer.cc:34
generate.env
env
Definition: generate.py:37
TSI_INTERNAL_ERROR
@ TSI_INTERNAL_ERROR
Definition: transport_security_interface.h:39
buf
voidpf void * buf
Definition: bloaty/third_party/zlib/contrib/minizip/ioapi.h:136
GRPC_STATUS_NOT_FOUND
@ GRPC_STATUS_NOT_FOUND
Definition: include/grpc/impl/codegen/status.h:56
grpc_gcp_HandshakerResp_new
UPB_INLINE grpc_gcp_HandshakerResp * grpc_gcp_HandshakerResp_new(upb_Arena *arena)
Definition: handshaker.upb.h:1032
ALTS_TSI_UTILS_TEST_OUT_FRAME
#define ALTS_TSI_UTILS_TEST_OUT_FRAME
Definition: alts_tsi_utils_test.cc:26
GRPC_STATUS_INVALID_ARGUMENT
@ GRPC_STATUS_INVALID_ARGUMENT
Definition: include/grpc/impl/codegen/status.h:46
arena
grpc_core::ScopedArenaPtr arena
Definition: binder_transport_test.cc:237
TSI_UNKNOWN_ERROR
@ TSI_UNKNOWN_ERROR
Definition: transport_security_interface.h:33
TSI_OK
@ TSI_OK
Definition: transport_security_interface.h:32
GRPC_STATUS_OK
@ GRPC_STATUS_OK
Definition: include/grpc/impl/codegen/status.h:30
GPR_ASSERT
#define GPR_ASSERT(x)
Definition: include/grpc/impl/codegen/log.h:94
grpc_gcp_HandshakerResp
struct grpc_gcp_HandshakerResp grpc_gcp_HandshakerResp
Definition: handshaker.upb.h:46
slice
grpc_slice slice
Definition: src/core/lib/surface/server.cc:467
http2_server_health_check.resp
resp
Definition: http2_server_health_check.py:31
grpc_byte_buffer
Definition: grpc_types.h:43
grpc_slice
Definition: include/grpc/impl/codegen/slice.h:65
alts_tsi_utils_deserialize_response
grpc_gcp_HandshakerResp * alts_tsi_utils_deserialize_response(grpc_byte_buffer *resp_buffer, upb_Arena *arena)
Definition: alts_tsi_utils.cc:44
buffer
char buffer[1024]
Definition: libuv/docs/code/idle-compute/main.c:8
deserialize_response_test
static void deserialize_response_test()
Definition: alts_tsi_utils_test.cc:42
grpc_gcp_HandshakerResp_serialize
UPB_INLINE char * grpc_gcp_HandshakerResp_serialize(const grpc_gcp_HandshakerResp *msg, upb_Arena *arena, size_t *len)
Definition: handshaker.upb.h:1054
GRPC_SLICE_LENGTH
#define GRPC_SLICE_LENGTH(slice)
Definition: include/grpc/impl/codegen/slice.h:104
GRPC_STATUS_OUT_OF_RANGE
@ GRPC_STATUS_OUT_OF_RANGE
Definition: include/grpc/impl/codegen/status.h:121
test_config.h
upb::Arena::ptr
upb_Arena * ptr()
Definition: upb.hpp:76
upb::Arena
Definition: upb.hpp:68
grpc_slice_from_copied_buffer
GPRAPI grpc_slice grpc_slice_from_copied_buffer(const char *source, size_t len)
Definition: slice/slice.cc:170
alts_tsi_utils.h
grpc_gcp_handshaker_resp_equals
bool grpc_gcp_handshaker_resp_equals(const grpc_gcp_HandshakerResp *l_resp, const grpc_gcp_HandshakerResp *r_resp)
Definition: alts_handshaker_service_api_test_lib.cc:105
upb.hpp
grpc::testing::TestEnvironment
Definition: test/core/util/test_config.h:54
grpc_byte_buffer_destroy
GRPCAPI void grpc_byte_buffer_destroy(grpc_byte_buffer *bb)
Definition: byte_buffer.cc:81
TSI_INVALID_ARGUMENT
@ TSI_INVALID_ARGUMENT
Definition: transport_security_interface.h:34
grpc_slice_split_head
GPRAPI grpc_slice grpc_slice_split_head(grpc_slice *s, size_t split)
Definition: slice/slice.cc:347
alts_tsi_utils_convert_to_tsi_result
tsi_result alts_tsi_utils_convert_to_tsi_result(grpc_status_code code)
Definition: alts_tsi_utils.cc:27
upb_StringView_FromString
UPB_INLINE upb_StringView upb_StringView_FromString(const char *data)
Definition: upb/upb/upb.h:85
GRPC_STATUS_INTERNAL
@ GRPC_STATUS_INTERNAL
Definition: include/grpc/impl/codegen/status.h:129
alts_handshaker_service_api_test_lib.h
main
int main(int argc, char **argv)
Definition: alts_tsi_utils_test.cc:73
grpc_init
GRPCAPI void grpc_init(void)
Definition: init.cc:146
grpc_gcp_HandshakerResp_set_out_frames
UPB_INLINE void grpc_gcp_HandshakerResp_set_out_frames(grpc_gcp_HandshakerResp *msg, upb_StringView value)
Definition: handshaker.upb.h:1092
convert_to_tsi_result_test
static void convert_to_tsi_result_test()
Definition: alts_tsi_utils_test.cc:28
grpc_shutdown
GRPCAPI void grpc_shutdown(void)
Definition: init.cc:209
GRPC_STATUS_UNKNOWN
@ GRPC_STATUS_UNKNOWN
Definition: include/grpc/impl/codegen/status.h:40
TSI_NOT_FOUND
@ TSI_NOT_FOUND
Definition: transport_security_interface.h:41


grpc
Author(s):
autogenerated on Fri May 16 2025 02:57:41