Imported Upstream version 1.22.0
[platform/upstream/grpc.git] / src / python / grpcio / grpc / _cython / _cygrpc / credentials.pxd.pxi
1 # Copyright 2015 gRPC authors.
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
6 #
7 #     http://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
14
15
16 cdef class CallCredentials:
17
18   cdef grpc_call_credentials *c(self) except *
19
20   # TODO(https://github.com/grpc/grpc/issues/12531): remove.
21   cdef grpc_call_credentials *c_credentials
22
23
24 cdef int _get_metadata(
25     void *state, grpc_auth_metadata_context context,
26     grpc_credentials_plugin_metadata_cb cb, void *user_data,
27     grpc_metadata creds_md[GRPC_METADATA_CREDENTIALS_PLUGIN_SYNC_MAX],
28     size_t *num_creds_md, grpc_status_code *status,
29     const char **error_details) except * with gil
30
31 cdef void _destroy(void *state) except * with gil
32
33
34 cdef class MetadataPluginCallCredentials(CallCredentials):
35
36   cdef readonly object _metadata_plugin
37   cdef readonly bytes _name
38
39   cdef grpc_call_credentials *c(self) except *
40
41
42 cdef grpc_call_credentials *_composition(call_credentialses)
43
44
45 cdef class CompositeCallCredentials(CallCredentials):
46
47   cdef readonly tuple _call_credentialses
48
49   cdef grpc_call_credentials *c(self) except *
50
51
52 cdef class ChannelCredentials:
53
54   cdef grpc_channel_credentials *c(self) except *
55
56
57 cdef class SSLSessionCacheLRU:
58
59   cdef grpc_ssl_session_cache *_cache
60
61
62 cdef class SSLChannelCredentials(ChannelCredentials):
63
64   cdef readonly object _pem_root_certificates
65   cdef readonly object _private_key
66   cdef readonly object _certificate_chain
67
68   cdef grpc_channel_credentials *c(self) except *
69
70
71 cdef class CompositeChannelCredentials(ChannelCredentials):
72
73   cdef readonly tuple _call_credentialses
74   cdef readonly ChannelCredentials _channel_credentials
75
76   cdef grpc_channel_credentials *c(self) except *
77
78
79 cdef class ServerCertificateConfig:
80
81   cdef grpc_ssl_server_certificate_config *c_cert_config
82   cdef const char *c_pem_root_certs
83   cdef grpc_ssl_pem_key_cert_pair *c_ssl_pem_key_cert_pairs
84   cdef size_t c_ssl_pem_key_cert_pairs_count
85   cdef list references
86
87
88 cdef class ServerCredentials:
89
90   cdef grpc_server_credentials *c_credentials
91   cdef grpc_ssl_pem_key_cert_pair *c_ssl_pem_key_cert_pairs
92   cdef size_t c_ssl_pem_key_cert_pairs_count
93   cdef list references
94   # the cert config related state is used only if this credentials is
95   # created with cert config/fetcher
96   cdef object initial_cert_config
97   cdef object cert_config_fetcher
98   # whether C-core has asked for the initial_cert_config
99   cdef bint initial_cert_config_fetched