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_LIB_SECURITY_CREDENTIALS_ALTS_GRPC_ALTS_CREDENTIALS_OPTIONS_H
20 #define GRPC_SRC_CORE_LIB_SECURITY_CREDENTIALS_ALTS_GRPC_ALTS_CREDENTIALS_OPTIONS_H
21 
22 #include <grpc/support/port_platform.h>
23 
24 #include <grpc/grpc_security.h>
25 
26 #include "src/core/tsi/alts/handshaker/transport_security_common_api.h"
27 
28 // V-table for grpc_alts_credentials_options
29 typedef struct grpc_alts_credentials_options_vtable {
30   grpc_alts_credentials_options* (*copy)(
31       const grpc_alts_credentials_options* options);
32   void (*destruct)(grpc_alts_credentials_options* options);
33 } grpc_alts_credentials_options_vtable;
34 
35 struct grpc_alts_credentials_options {
36   const struct grpc_alts_credentials_options_vtable* vtable;
37   grpc_gcp_rpc_protocol_versions rpc_versions;
38 };
39 
40 typedef struct target_service_account {
41   struct target_service_account* next;
42   char* data;
43 } target_service_account;
44 
45 ///
46 /// Main struct for ALTS client credentials options. The options contain a
47 /// a list of target service accounts (if specified) used for secure naming
48 /// check.
49 ///
50 typedef struct grpc_alts_credentials_client_options {
51   grpc_alts_credentials_options base;
52   target_service_account* target_account_list_head;
53 } grpc_alts_credentials_client_options;
54 
55 ///
56 /// Main struct for ALTS server credentials options. The options currently
57 /// do not contain any server-specific fields.
58 ///
59 typedef struct grpc_alts_credentials_server_options {
60   grpc_alts_credentials_options base;
61 } grpc_alts_credentials_server_options;
62 
63 ///
64 /// This method performs a deep copy on grpc_alts_credentials_options instance.
65 ///
66 ///- options: a grpc_alts_credentials_options instance that needs to be copied.
67 ///
68 /// It returns a new grpc_alts_credentials_options instance on success and NULL
69 /// on failure.
70 ///
71 grpc_alts_credentials_options* grpc_alts_credentials_options_copy(
72     const grpc_alts_credentials_options* options);
73 
74 #endif  // GRPC_SRC_CORE_LIB_SECURITY_CREDENTIALS_ALTS_GRPC_ALTS_CREDENTIALS_OPTIONS_H
75