blob: 6e9f9a8f6fa794844d6e295b473df5df1309c112 [file] [log] [blame]
Julien Boeuf8ca294e2016-05-02 14:56:30 -07001/*
2 *
Jan Tattermusch7897ae92017-06-07 22:57:36 +02003 * Copyright 2015 gRPC authors.
Julien Boeuf8ca294e2016-05-02 14:56:30 -07004 *
Jan Tattermusch7897ae92017-06-07 22:57:36 +02005 * 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 Boeuf8ca294e2016-05-02 14:56:30 -07008 *
Jan Tattermusch7897ae92017-06-07 22:57:36 +02009 * http://www.apache.org/licenses/LICENSE-2.0
Julien Boeuf8ca294e2016-05-02 14:56:30 -070010 *
Jan Tattermusch7897ae92017-06-07 22:57:36 +020011 * 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 Boeuf8ca294e2016-05-02 14:56:30 -070016 *
17 */
18
Julien Boeuf2b2f4142016-05-10 15:29:42 -070019#ifndef GRPC_CORE_LIB_SECURITY_CREDENTIALS_COMPOSITE_COMPOSITE_CREDENTIALS_H
20#define GRPC_CORE_LIB_SECURITY_CREDENTIALS_COMPOSITE_COMPOSITE_CREDENTIALS_H
Julien Boeuf8ca294e2016-05-02 14:56:30 -070021
22#include "src/core/lib/security/credentials/credentials.h"
23
Yash Tibrewala7e6d652017-09-20 18:56:37 -070024#ifdef __cplusplus
25extern "C" {
26#endif
27
Julien Boeuf8ca294e2016-05-02 14:56:30 -070028typedef struct {
29 grpc_call_credentials **creds_array;
30 size_t num_creds;
31} grpc_call_credentials_array;
32
33const grpc_call_credentials_array *
34grpc_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. */
41grpc_call_credentials *grpc_credentials_contains_type(
42 grpc_call_credentials *creds, const char *type,
43 grpc_call_credentials **composite_creds);
44
Julien Boeufe26ab6c2016-09-22 15:13:07 -070045/* -- Composite channel credentials. -- */
Julien Boeuf8ca294e2016-05-02 14:56:30 -070046
47typedef 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 Boeufe26ab6c2016-09-22 15:13:07 -070053/* -- Composite call credentials. -- */
Julien Boeuf8ca294e2016-05-02 14:56:30 -070054
55typedef struct {
56 grpc_call_credentials base;
57 grpc_call_credentials_array inner;
58} grpc_composite_call_credentials;
59
Yash Tibrewala7e6d652017-09-20 18:56:37 -070060#ifdef __cplusplus
61}
62#endif
63
Julien Boeuffc1ed172016-05-10 15:38:28 -070064#endif /* GRPC_CORE_LIB_SECURITY_CREDENTIALS_COMPOSITE_COMPOSITE_CREDENTIALS_H \
65 */