GRPC Core  9.0.0
alts_handshaker_client.h
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 
19 #ifndef GRPC_CORE_TSI_ALTS_HANDSHAKER_ALTS_HANDSHAKER_CLIENT_H
20 #define GRPC_CORE_TSI_ALTS_HANDSHAKER_ALTS_HANDSHAKER_CLIENT_H
21 
23 
24 #include <grpc/byte_buffer.h>
26 #include <grpc/grpc.h>
27 
30 
33 
34 #define ALTS_SERVICE_METHOD "/grpc.gcp.HandshakerService/DoHandshake"
35 #define ALTS_APPLICATION_PROTOCOL "grpc"
36 #define ALTS_RECORD_PROTOCOL "ALTSRP_GCM_AES128_REKEY"
37 #define ALTS_HANDSHAKER_SERVICE_URL_FOR_TESTING "lame"
38 
39 const size_t kAltsAes128GcmRekeyKeyLength = 44;
40 
49 
50 /* A function that makes the grpc call to the handshaker service. */
51 typedef grpc_call_error (*alts_grpc_caller)(grpc_call* call, const grpc_op* ops,
52  size_t nops, grpc_closure* tag);
53 
54 /* V-table for ALTS handshaker client operations. */
58  grpc_slice* bytes_received);
60  grpc_slice* bytes_received);
61  void (*shutdown)(alts_handshaker_client* client);
62  void (*destruct)(alts_handshaker_client* client);
64 
74 
86  grpc_slice* bytes_received);
87 
98  grpc_slice* bytes_received);
99 
108 
115 
139  alts_tsi_handshaker* handshaker, grpc_channel* channel,
140  const char* handshaker_service_url, grpc_pollset_set* interested_parties,
141  grpc_alts_credentials_options* options, const grpc_slice& target_name,
143  void* user_data, alts_handshaker_client_vtable* vtable_for_testing,
144  bool is_client);
145 
155  bool is_ok);
156 
157 #endif /* GRPC_CORE_TSI_ALTS_HANDSHAKER_ALTS_HANDSHAKER_CLIENT_H */
void(* destruct)(alts_handshaker_client *client)
Definition: alts_handshaker_client.h:62
struct alts_handshaker_client_vtable alts_handshaker_client_vtable
Definition: channel.h:66
tsi_result(* server_start)(alts_handshaker_client *client, grpc_slice *bytes_received)
Definition: alts_handshaker_client.h:57
Definition: alts_handshaker_client.h:55
A grpc_slice s, if initialized, represents the byte range s.bytes[0..s.length-1]. ...
Definition: slice.h:60
grpc_call_error
Result of a grpc call.
Definition: grpc_types.h:407
grpc_call_error(* alts_grpc_caller)(grpc_call *call, const grpc_op *ops, size_t nops, grpc_closure *tag)
Definition: alts_handshaker_client.h:51
void(* tsi_handshaker_on_next_done_cb)(tsi_result status, void *user_data, const unsigned char *bytes_to_send, size_t bytes_to_send_size, tsi_handshaker_result *handshaker_result)
Definition: transport_security_interface.h:417
Definition: alts_tsi_handshaker.cc:45
tsi_result alts_handshaker_client_start_server(alts_handshaker_client *client, grpc_slice *bytes_received)
This method schedules a server_start handshaker request to ALTS handshaker service.
Definition: alts_handshaker_client.cc:857
tsi_result alts_handshaker_client_start_client(alts_handshaker_client *client)
This method schedules a client_start handshaker request to ALTS handshaker service.
Definition: alts_handshaker_client.cc:847
tsi_result alts_handshaker_client_next(alts_handshaker_client *client, grpc_slice *bytes_received)
This method schedules a next handshaker request to ALTS handshaker service.
Definition: alts_handshaker_client.cc:868
void(* shutdown)(alts_handshaker_client *client)
Definition: alts_handshaker_client.h:61
Definition: grpc_alts_credentials_options.h:35
alts_handshaker_client * alts_grpc_handshaker_client_create(alts_tsi_handshaker *handshaker, grpc_channel *channel, const char *handshaker_service_url, grpc_pollset_set *interested_parties, grpc_alts_credentials_options *options, const grpc_slice &target_name, grpc_iomgr_cb_func grpc_cb, tsi_handshaker_on_next_done_cb cb, void *user_data, alts_handshaker_client_vtable *vtable_for_testing, bool is_client)
This method creates an ALTS handshaker client.
Definition: alts_handshaker_client.cc:671
Operation data: one field for each op type (except SEND_CLOSE_FROM_CLIENT which has no arguments) ...
Definition: grpc_types.h:590
tsi_result(* client_start)(alts_handshaker_client *client)
Definition: alts_handshaker_client.h:56
tsi_result
Definition: transport_security_interface.h:31
struct grpc_pollset_set grpc_pollset_set
Definition: pollset_set.h:31
tsi_result(* next)(alts_handshaker_client *client, grpc_slice *bytes_received)
Definition: alts_handshaker_client.h:59
void alts_handshaker_client_handle_response(alts_handshaker_client *client, bool is_ok)
This method handles handshaker response returned from ALTS handshaker service.
Definition: alts_handshaker_client.cc:191
A closure over a grpc_iomgr_cb_func.
Definition: closure.h:56
void alts_handshaker_client_shutdown(alts_handshaker_client *client)
This method cancels previously scheduled, but yet executed handshaker requests to ALTS handshaker ser...
Definition: alts_handshaker_client.cc:879
void alts_handshaker_client_destroy(alts_handshaker_client *client)
This method destroys an ALTS handshaker client.
Definition: alts_handshaker_client.cc:886
Definition: alts_handshaker_client.cc:41
const size_t kAltsAes128GcmRekeyKeyLength
Definition: alts_handshaker_client.h:39
void(* grpc_iomgr_cb_func)(void *arg, grpc_error *error)
gRPC Callback definition.
Definition: closure.h:53
Definition: call.cc:134