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 
19 #ifndef GRPC_SRC_CORE_TSI_ALTS_HANDSHAKER_ALTS_TSI_HANDSHAKER_PRIVATE_H
20 #define GRPC_SRC_CORE_TSI_ALTS_HANDSHAKER_ALTS_TSI_HANDSHAKER_PRIVATE_H
21 
22 #include <grpc/support/port_platform.h>
23 
24 #include "src/core/tsi/alts/handshaker/alts_handshaker_client.h"
25 
26 namespace grpc_core {
27 namespace internal {
28 
29 ///
30 /// Unsafe, use for testing only.
31 
32 alts_handshaker_client* alts_tsi_handshaker_get_client_for_testing(
33     alts_tsi_handshaker* handshaker);
34 
35 bool alts_tsi_handshaker_get_has_sent_start_message_for_testing(
36     alts_tsi_handshaker* handshaker);
37 
38 void alts_tsi_handshaker_set_client_vtable_for_testing(
39     alts_tsi_handshaker* handshaker, alts_handshaker_client_vtable* vtable);
40 
41 bool alts_tsi_handshaker_get_is_client_for_testing(
42     alts_tsi_handshaker* handshaker);
43 
44 void alts_handshaker_client_set_grpc_caller_for_testing(
45     alts_handshaker_client* client, alts_grpc_caller caller);
46 
47 grpc_byte_buffer* alts_handshaker_client_get_send_buffer_for_testing(
48     alts_handshaker_client* client);
49 
50 grpc_byte_buffer** alts_handshaker_client_get_recv_buffer_addr_for_testing(
51     alts_handshaker_client* client);
52 
53 grpc_metadata_array* alts_handshaker_client_get_initial_metadata_for_testing(
54     alts_handshaker_client* client);
55 
56 void alts_handshaker_client_set_recv_bytes_for_testing(
57     alts_handshaker_client* client, grpc_slice* recv_bytes);
58 
59 void alts_handshaker_client_check_fields_for_testing(
60     alts_handshaker_client* client, tsi_handshaker_on_next_done_cb cb,
61     void* user_data, bool has_sent_start_message, grpc_slice* recv_bytes);
62 
63 void alts_handshaker_client_set_fields_for_testing(
64     alts_handshaker_client* client, alts_tsi_handshaker* handshaker,
65     tsi_handshaker_on_next_done_cb cb, void* user_data,
66     grpc_byte_buffer* recv_buffer, bool inject_read_failure);
67 
68 void alts_handshaker_client_set_vtable_for_testing(
69     alts_handshaker_client* client, alts_handshaker_client_vtable* vtable);
70 
71 alts_tsi_handshaker* alts_handshaker_client_get_handshaker_for_testing(
72     alts_handshaker_client* client);
73 
74 void alts_handshaker_client_set_cb_for_testing(
75     alts_handshaker_client* client, tsi_handshaker_on_next_done_cb cb);
76 
77 grpc_closure* alts_handshaker_client_get_closure_for_testing(
78     alts_handshaker_client* client);
79 
80 void alts_handshaker_client_on_status_received_for_testing(
81     alts_handshaker_client* client, grpc_status_code status,
82     grpc_error_handle error);
83 
84 void alts_handshaker_client_ref_for_testing(alts_handshaker_client* c);
85 
86 }  // namespace internal
87 }  // namespace grpc_core
88 
89 #endif  // GRPC_SRC_CORE_TSI_ALTS_HANDSHAKER_ALTS_TSI_HANDSHAKER_PRIVATE_H
90