Julien Boeuf | 8ca294e | 2016-05-02 14:56:30 -0700 | [diff] [blame] | 1 | /* |
| 2 | * |
Jan Tattermusch | 7897ae9 | 2017-06-07 22:57:36 +0200 | [diff] [blame] | 3 | * Copyright 2015 gRPC authors. |
Julien Boeuf | 8ca294e | 2016-05-02 14:56:30 -0700 | [diff] [blame] | 4 | * |
Jan Tattermusch | 7897ae9 | 2017-06-07 22:57:36 +0200 | [diff] [blame] | 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 |
Julien Boeuf | 8ca294e | 2016-05-02 14:56:30 -0700 | [diff] [blame] | 8 | * |
Jan Tattermusch | 7897ae9 | 2017-06-07 22:57:36 +0200 | [diff] [blame] | 9 | * http://www.apache.org/licenses/LICENSE-2.0 |
Julien Boeuf | 8ca294e | 2016-05-02 14:56:30 -0700 | [diff] [blame] | 10 | * |
Jan Tattermusch | 7897ae9 | 2017-06-07 22:57:36 +0200 | [diff] [blame] | 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. |
Julien Boeuf | 8ca294e | 2016-05-02 14:56:30 -0700 | [diff] [blame] | 16 | * |
| 17 | */ |
| 18 | |
Julien Boeuf | 2b2f414 | 2016-05-10 15:29:42 -0700 | [diff] [blame] | 19 | #ifndef GRPC_CORE_LIB_SECURITY_CREDENTIALS_COMPOSITE_COMPOSITE_CREDENTIALS_H |
| 20 | #define GRPC_CORE_LIB_SECURITY_CREDENTIALS_COMPOSITE_COMPOSITE_CREDENTIALS_H |
Julien Boeuf | 8ca294e | 2016-05-02 14:56:30 -0700 | [diff] [blame] | 21 | |
| 22 | #include "src/core/lib/security/credentials/credentials.h" |
| 23 | |
Yash Tibrewal | a7e6d65 | 2017-09-20 18:56:37 -0700 | [diff] [blame] | 24 | #ifdef __cplusplus |
| 25 | extern "C" { |
| 26 | #endif |
| 27 | |
Julien Boeuf | 8ca294e | 2016-05-02 14:56:30 -0700 | [diff] [blame] | 28 | typedef struct { |
| 29 | grpc_call_credentials **creds_array; |
| 30 | size_t num_creds; |
| 31 | } grpc_call_credentials_array; |
| 32 | |
| 33 | const grpc_call_credentials_array * |
| 34 | grpc_composite_call_credentials_get_credentials( |
| 35 | grpc_call_credentials *composite_creds); |
| 36 | |
| 37 | /* Returns creds if creds is of the specified type or the inner creds of the |
| 38 | specified type (if found), if the creds is of type COMPOSITE. |
| 39 | If composite_creds is not NULL, *composite_creds will point to creds if of |
| 40 | type COMPOSITE in case of success. */ |
| 41 | grpc_call_credentials *grpc_credentials_contains_type( |
| 42 | grpc_call_credentials *creds, const char *type, |
| 43 | grpc_call_credentials **composite_creds); |
| 44 | |
Julien Boeuf | e26ab6c | 2016-09-22 15:13:07 -0700 | [diff] [blame] | 45 | /* -- Composite channel credentials. -- */ |
Julien Boeuf | 8ca294e | 2016-05-02 14:56:30 -0700 | [diff] [blame] | 46 | |
| 47 | typedef struct { |
| 48 | grpc_channel_credentials base; |
| 49 | grpc_channel_credentials *inner_creds; |
| 50 | grpc_call_credentials *call_creds; |
| 51 | } grpc_composite_channel_credentials; |
| 52 | |
Julien Boeuf | e26ab6c | 2016-09-22 15:13:07 -0700 | [diff] [blame] | 53 | /* -- Composite call credentials. -- */ |
Julien Boeuf | 8ca294e | 2016-05-02 14:56:30 -0700 | [diff] [blame] | 54 | |
| 55 | typedef struct { |
| 56 | grpc_call_credentials base; |
| 57 | grpc_call_credentials_array inner; |
| 58 | } grpc_composite_call_credentials; |
| 59 | |
Yash Tibrewal | a7e6d65 | 2017-09-20 18:56:37 -0700 | [diff] [blame] | 60 | #ifdef __cplusplus |
| 61 | } |
| 62 | #endif |
| 63 | |
Julien Boeuf | fc1ed17 | 2016-05-10 15:38:28 -0700 | [diff] [blame] | 64 | #endif /* GRPC_CORE_LIB_SECURITY_CREDENTIALS_COMPOSITE_COMPOSITE_CREDENTIALS_H \ |
| 65 | */ |