• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 
2 #region Copyright notice and license
3 
4 // Copyright 2015 gRPC authors.
5 //
6 // Licensed under the Apache License, Version 2.0 (the "License");
7 // you may not use this file except in compliance with the License.
8 // You may obtain a copy of the License at
9 //
10 //     http://www.apache.org/licenses/LICENSE-2.0
11 //
12 // Unless required by applicable law or agreed to in writing, software
13 // distributed under the License is distributed on an "AS IS" BASIS,
14 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 // See the License for the specific language governing permissions and
16 // limitations under the License.
17 
18 #endregion
19 
20 using System;
21 using System.Collections.Concurrent;
22 using System.Diagnostics;
23 using System.IO;
24 using System.Reflection;
25 using System.Runtime.InteropServices;
26 using System.Threading;
27 
28 using Grpc.Core.Logging;
29 using Grpc.Core.Utils;
30 
31 namespace Grpc.Core.Internal
32 {
33     internal partial class NativeMethods
34     {
35         #region Native methods
36 
37         public readonly Delegates.grpcsharp_init_delegate grpcsharp_init;
38         public readonly Delegates.grpcsharp_shutdown_delegate grpcsharp_shutdown;
39         public readonly Delegates.grpcsharp_version_string_delegate grpcsharp_version_string;
40         public readonly Delegates.grpcsharp_batch_context_create_delegate grpcsharp_batch_context_create;
41         public readonly Delegates.grpcsharp_batch_context_recv_initial_metadata_delegate grpcsharp_batch_context_recv_initial_metadata;
42         public readonly Delegates.grpcsharp_batch_context_recv_message_length_delegate grpcsharp_batch_context_recv_message_length;
43         public readonly Delegates.grpcsharp_batch_context_recv_message_to_buffer_delegate grpcsharp_batch_context_recv_message_to_buffer;
44         public readonly Delegates.grpcsharp_batch_context_recv_status_on_client_status_delegate grpcsharp_batch_context_recv_status_on_client_status;
45         public readonly Delegates.grpcsharp_batch_context_recv_status_on_client_details_delegate grpcsharp_batch_context_recv_status_on_client_details;
46         public readonly Delegates.grpcsharp_batch_context_recv_status_on_client_trailing_metadata_delegate grpcsharp_batch_context_recv_status_on_client_trailing_metadata;
47         public readonly Delegates.grpcsharp_batch_context_recv_close_on_server_cancelled_delegate grpcsharp_batch_context_recv_close_on_server_cancelled;
48         public readonly Delegates.grpcsharp_batch_context_reset_delegate grpcsharp_batch_context_reset;
49         public readonly Delegates.grpcsharp_batch_context_destroy_delegate grpcsharp_batch_context_destroy;
50         public readonly Delegates.grpcsharp_request_call_context_create_delegate grpcsharp_request_call_context_create;
51         public readonly Delegates.grpcsharp_request_call_context_call_delegate grpcsharp_request_call_context_call;
52         public readonly Delegates.grpcsharp_request_call_context_method_delegate grpcsharp_request_call_context_method;
53         public readonly Delegates.grpcsharp_request_call_context_host_delegate grpcsharp_request_call_context_host;
54         public readonly Delegates.grpcsharp_request_call_context_deadline_delegate grpcsharp_request_call_context_deadline;
55         public readonly Delegates.grpcsharp_request_call_context_request_metadata_delegate grpcsharp_request_call_context_request_metadata;
56         public readonly Delegates.grpcsharp_request_call_context_reset_delegate grpcsharp_request_call_context_reset;
57         public readonly Delegates.grpcsharp_request_call_context_destroy_delegate grpcsharp_request_call_context_destroy;
58         public readonly Delegates.grpcsharp_composite_call_credentials_create_delegate grpcsharp_composite_call_credentials_create;
59         public readonly Delegates.grpcsharp_call_credentials_release_delegate grpcsharp_call_credentials_release;
60         public readonly Delegates.grpcsharp_call_cancel_delegate grpcsharp_call_cancel;
61         public readonly Delegates.grpcsharp_call_cancel_with_status_delegate grpcsharp_call_cancel_with_status;
62         public readonly Delegates.grpcsharp_call_start_unary_delegate grpcsharp_call_start_unary;
63         public readonly Delegates.grpcsharp_call_start_client_streaming_delegate grpcsharp_call_start_client_streaming;
64         public readonly Delegates.grpcsharp_call_start_server_streaming_delegate grpcsharp_call_start_server_streaming;
65         public readonly Delegates.grpcsharp_call_start_duplex_streaming_delegate grpcsharp_call_start_duplex_streaming;
66         public readonly Delegates.grpcsharp_call_send_message_delegate grpcsharp_call_send_message;
67         public readonly Delegates.grpcsharp_call_send_close_from_client_delegate grpcsharp_call_send_close_from_client;
68         public readonly Delegates.grpcsharp_call_send_status_from_server_delegate grpcsharp_call_send_status_from_server;
69         public readonly Delegates.grpcsharp_call_recv_message_delegate grpcsharp_call_recv_message;
70         public readonly Delegates.grpcsharp_call_recv_initial_metadata_delegate grpcsharp_call_recv_initial_metadata;
71         public readonly Delegates.grpcsharp_call_start_serverside_delegate grpcsharp_call_start_serverside;
72         public readonly Delegates.grpcsharp_call_send_initial_metadata_delegate grpcsharp_call_send_initial_metadata;
73         public readonly Delegates.grpcsharp_call_set_credentials_delegate grpcsharp_call_set_credentials;
74         public readonly Delegates.grpcsharp_call_get_peer_delegate grpcsharp_call_get_peer;
75         public readonly Delegates.grpcsharp_call_destroy_delegate grpcsharp_call_destroy;
76         public readonly Delegates.grpcsharp_channel_args_create_delegate grpcsharp_channel_args_create;
77         public readonly Delegates.grpcsharp_channel_args_set_string_delegate grpcsharp_channel_args_set_string;
78         public readonly Delegates.grpcsharp_channel_args_set_integer_delegate grpcsharp_channel_args_set_integer;
79         public readonly Delegates.grpcsharp_channel_args_destroy_delegate grpcsharp_channel_args_destroy;
80         public readonly Delegates.grpcsharp_override_default_ssl_roots_delegate grpcsharp_override_default_ssl_roots;
81         public readonly Delegates.grpcsharp_ssl_credentials_create_delegate grpcsharp_ssl_credentials_create;
82         public readonly Delegates.grpcsharp_composite_channel_credentials_create_delegate grpcsharp_composite_channel_credentials_create;
83         public readonly Delegates.grpcsharp_channel_credentials_release_delegate grpcsharp_channel_credentials_release;
84         public readonly Delegates.grpcsharp_insecure_channel_create_delegate grpcsharp_insecure_channel_create;
85         public readonly Delegates.grpcsharp_secure_channel_create_delegate grpcsharp_secure_channel_create;
86         public readonly Delegates.grpcsharp_channel_create_call_delegate grpcsharp_channel_create_call;
87         public readonly Delegates.grpcsharp_channel_check_connectivity_state_delegate grpcsharp_channel_check_connectivity_state;
88         public readonly Delegates.grpcsharp_channel_watch_connectivity_state_delegate grpcsharp_channel_watch_connectivity_state;
89         public readonly Delegates.grpcsharp_channel_get_target_delegate grpcsharp_channel_get_target;
90         public readonly Delegates.grpcsharp_channel_destroy_delegate grpcsharp_channel_destroy;
91         public readonly Delegates.grpcsharp_sizeof_grpc_event_delegate grpcsharp_sizeof_grpc_event;
92         public readonly Delegates.grpcsharp_completion_queue_create_async_delegate grpcsharp_completion_queue_create_async;
93         public readonly Delegates.grpcsharp_completion_queue_create_sync_delegate grpcsharp_completion_queue_create_sync;
94         public readonly Delegates.grpcsharp_completion_queue_shutdown_delegate grpcsharp_completion_queue_shutdown;
95         public readonly Delegates.grpcsharp_completion_queue_next_delegate grpcsharp_completion_queue_next;
96         public readonly Delegates.grpcsharp_completion_queue_pluck_delegate grpcsharp_completion_queue_pluck;
97         public readonly Delegates.grpcsharp_completion_queue_destroy_delegate grpcsharp_completion_queue_destroy;
98         public readonly Delegates.gprsharp_free_delegate gprsharp_free;
99         public readonly Delegates.grpcsharp_metadata_array_create_delegate grpcsharp_metadata_array_create;
100         public readonly Delegates.grpcsharp_metadata_array_add_delegate grpcsharp_metadata_array_add;
101         public readonly Delegates.grpcsharp_metadata_array_count_delegate grpcsharp_metadata_array_count;
102         public readonly Delegates.grpcsharp_metadata_array_get_key_delegate grpcsharp_metadata_array_get_key;
103         public readonly Delegates.grpcsharp_metadata_array_get_value_delegate grpcsharp_metadata_array_get_value;
104         public readonly Delegates.grpcsharp_metadata_array_destroy_full_delegate grpcsharp_metadata_array_destroy_full;
105         public readonly Delegates.grpcsharp_redirect_log_delegate grpcsharp_redirect_log;
106         public readonly Delegates.grpcsharp_metadata_credentials_create_from_plugin_delegate grpcsharp_metadata_credentials_create_from_plugin;
107         public readonly Delegates.grpcsharp_metadata_credentials_notify_from_plugin_delegate grpcsharp_metadata_credentials_notify_from_plugin;
108         public readonly Delegates.grpcsharp_ssl_server_credentials_create_delegate grpcsharp_ssl_server_credentials_create;
109         public readonly Delegates.grpcsharp_server_credentials_release_delegate grpcsharp_server_credentials_release;
110         public readonly Delegates.grpcsharp_server_create_delegate grpcsharp_server_create;
111         public readonly Delegates.grpcsharp_server_register_completion_queue_delegate grpcsharp_server_register_completion_queue;
112         public readonly Delegates.grpcsharp_server_add_insecure_http2_port_delegate grpcsharp_server_add_insecure_http2_port;
113         public readonly Delegates.grpcsharp_server_add_secure_http2_port_delegate grpcsharp_server_add_secure_http2_port;
114         public readonly Delegates.grpcsharp_server_start_delegate grpcsharp_server_start;
115         public readonly Delegates.grpcsharp_server_request_call_delegate grpcsharp_server_request_call;
116         public readonly Delegates.grpcsharp_server_cancel_all_calls_delegate grpcsharp_server_cancel_all_calls;
117         public readonly Delegates.grpcsharp_server_shutdown_and_notify_callback_delegate grpcsharp_server_shutdown_and_notify_callback;
118         public readonly Delegates.grpcsharp_server_destroy_delegate grpcsharp_server_destroy;
119         public readonly Delegates.grpcsharp_call_auth_context_delegate grpcsharp_call_auth_context;
120         public readonly Delegates.grpcsharp_auth_context_peer_identity_property_name_delegate grpcsharp_auth_context_peer_identity_property_name;
121         public readonly Delegates.grpcsharp_auth_context_property_iterator_delegate grpcsharp_auth_context_property_iterator;
122         public readonly Delegates.grpcsharp_auth_property_iterator_next_delegate grpcsharp_auth_property_iterator_next;
123         public readonly Delegates.grpcsharp_auth_context_release_delegate grpcsharp_auth_context_release;
124         public readonly Delegates.gprsharp_now_delegate gprsharp_now;
125         public readonly Delegates.gprsharp_inf_future_delegate gprsharp_inf_future;
126         public readonly Delegates.gprsharp_inf_past_delegate gprsharp_inf_past;
127         public readonly Delegates.gprsharp_convert_clock_type_delegate gprsharp_convert_clock_type;
128         public readonly Delegates.gprsharp_sizeof_timespec_delegate gprsharp_sizeof_timespec;
129         public readonly Delegates.grpcsharp_test_callback_delegate grpcsharp_test_callback;
130         public readonly Delegates.grpcsharp_test_nop_delegate grpcsharp_test_nop;
131         public readonly Delegates.grpcsharp_test_override_method_delegate grpcsharp_test_override_method;
132 
133         #endregion
134 
NativeMethods(UnmanagedLibrary library)135         public NativeMethods(UnmanagedLibrary library)
136         {
137             this.grpcsharp_init = GetMethodDelegate<Delegates.grpcsharp_init_delegate>(library);
138             this.grpcsharp_shutdown = GetMethodDelegate<Delegates.grpcsharp_shutdown_delegate>(library);
139             this.grpcsharp_version_string = GetMethodDelegate<Delegates.grpcsharp_version_string_delegate>(library);
140             this.grpcsharp_batch_context_create = GetMethodDelegate<Delegates.grpcsharp_batch_context_create_delegate>(library);
141             this.grpcsharp_batch_context_recv_initial_metadata = GetMethodDelegate<Delegates.grpcsharp_batch_context_recv_initial_metadata_delegate>(library);
142             this.grpcsharp_batch_context_recv_message_length = GetMethodDelegate<Delegates.grpcsharp_batch_context_recv_message_length_delegate>(library);
143             this.grpcsharp_batch_context_recv_message_to_buffer = GetMethodDelegate<Delegates.grpcsharp_batch_context_recv_message_to_buffer_delegate>(library);
144             this.grpcsharp_batch_context_recv_status_on_client_status = GetMethodDelegate<Delegates.grpcsharp_batch_context_recv_status_on_client_status_delegate>(library);
145             this.grpcsharp_batch_context_recv_status_on_client_details = GetMethodDelegate<Delegates.grpcsharp_batch_context_recv_status_on_client_details_delegate>(library);
146             this.grpcsharp_batch_context_recv_status_on_client_trailing_metadata = GetMethodDelegate<Delegates.grpcsharp_batch_context_recv_status_on_client_trailing_metadata_delegate>(library);
147             this.grpcsharp_batch_context_recv_close_on_server_cancelled = GetMethodDelegate<Delegates.grpcsharp_batch_context_recv_close_on_server_cancelled_delegate>(library);
148             this.grpcsharp_batch_context_reset = GetMethodDelegate<Delegates.grpcsharp_batch_context_reset_delegate>(library);
149             this.grpcsharp_batch_context_destroy = GetMethodDelegate<Delegates.grpcsharp_batch_context_destroy_delegate>(library);
150             this.grpcsharp_request_call_context_create = GetMethodDelegate<Delegates.grpcsharp_request_call_context_create_delegate>(library);
151             this.grpcsharp_request_call_context_call = GetMethodDelegate<Delegates.grpcsharp_request_call_context_call_delegate>(library);
152             this.grpcsharp_request_call_context_method = GetMethodDelegate<Delegates.grpcsharp_request_call_context_method_delegate>(library);
153             this.grpcsharp_request_call_context_host = GetMethodDelegate<Delegates.grpcsharp_request_call_context_host_delegate>(library);
154             this.grpcsharp_request_call_context_deadline = GetMethodDelegate<Delegates.grpcsharp_request_call_context_deadline_delegate>(library);
155             this.grpcsharp_request_call_context_request_metadata = GetMethodDelegate<Delegates.grpcsharp_request_call_context_request_metadata_delegate>(library);
156             this.grpcsharp_request_call_context_reset = GetMethodDelegate<Delegates.grpcsharp_request_call_context_reset_delegate>(library);
157             this.grpcsharp_request_call_context_destroy = GetMethodDelegate<Delegates.grpcsharp_request_call_context_destroy_delegate>(library);
158             this.grpcsharp_composite_call_credentials_create = GetMethodDelegate<Delegates.grpcsharp_composite_call_credentials_create_delegate>(library);
159             this.grpcsharp_call_credentials_release = GetMethodDelegate<Delegates.grpcsharp_call_credentials_release_delegate>(library);
160             this.grpcsharp_call_cancel = GetMethodDelegate<Delegates.grpcsharp_call_cancel_delegate>(library);
161             this.grpcsharp_call_cancel_with_status = GetMethodDelegate<Delegates.grpcsharp_call_cancel_with_status_delegate>(library);
162             this.grpcsharp_call_start_unary = GetMethodDelegate<Delegates.grpcsharp_call_start_unary_delegate>(library);
163             this.grpcsharp_call_start_client_streaming = GetMethodDelegate<Delegates.grpcsharp_call_start_client_streaming_delegate>(library);
164             this.grpcsharp_call_start_server_streaming = GetMethodDelegate<Delegates.grpcsharp_call_start_server_streaming_delegate>(library);
165             this.grpcsharp_call_start_duplex_streaming = GetMethodDelegate<Delegates.grpcsharp_call_start_duplex_streaming_delegate>(library);
166             this.grpcsharp_call_send_message = GetMethodDelegate<Delegates.grpcsharp_call_send_message_delegate>(library);
167             this.grpcsharp_call_send_close_from_client = GetMethodDelegate<Delegates.grpcsharp_call_send_close_from_client_delegate>(library);
168             this.grpcsharp_call_send_status_from_server = GetMethodDelegate<Delegates.grpcsharp_call_send_status_from_server_delegate>(library);
169             this.grpcsharp_call_recv_message = GetMethodDelegate<Delegates.grpcsharp_call_recv_message_delegate>(library);
170             this.grpcsharp_call_recv_initial_metadata = GetMethodDelegate<Delegates.grpcsharp_call_recv_initial_metadata_delegate>(library);
171             this.grpcsharp_call_start_serverside = GetMethodDelegate<Delegates.grpcsharp_call_start_serverside_delegate>(library);
172             this.grpcsharp_call_send_initial_metadata = GetMethodDelegate<Delegates.grpcsharp_call_send_initial_metadata_delegate>(library);
173             this.grpcsharp_call_set_credentials = GetMethodDelegate<Delegates.grpcsharp_call_set_credentials_delegate>(library);
174             this.grpcsharp_call_get_peer = GetMethodDelegate<Delegates.grpcsharp_call_get_peer_delegate>(library);
175             this.grpcsharp_call_destroy = GetMethodDelegate<Delegates.grpcsharp_call_destroy_delegate>(library);
176             this.grpcsharp_channel_args_create = GetMethodDelegate<Delegates.grpcsharp_channel_args_create_delegate>(library);
177             this.grpcsharp_channel_args_set_string = GetMethodDelegate<Delegates.grpcsharp_channel_args_set_string_delegate>(library);
178             this.grpcsharp_channel_args_set_integer = GetMethodDelegate<Delegates.grpcsharp_channel_args_set_integer_delegate>(library);
179             this.grpcsharp_channel_args_destroy = GetMethodDelegate<Delegates.grpcsharp_channel_args_destroy_delegate>(library);
180             this.grpcsharp_override_default_ssl_roots = GetMethodDelegate<Delegates.grpcsharp_override_default_ssl_roots_delegate>(library);
181             this.grpcsharp_ssl_credentials_create = GetMethodDelegate<Delegates.grpcsharp_ssl_credentials_create_delegate>(library);
182             this.grpcsharp_composite_channel_credentials_create = GetMethodDelegate<Delegates.grpcsharp_composite_channel_credentials_create_delegate>(library);
183             this.grpcsharp_channel_credentials_release = GetMethodDelegate<Delegates.grpcsharp_channel_credentials_release_delegate>(library);
184             this.grpcsharp_insecure_channel_create = GetMethodDelegate<Delegates.grpcsharp_insecure_channel_create_delegate>(library);
185             this.grpcsharp_secure_channel_create = GetMethodDelegate<Delegates.grpcsharp_secure_channel_create_delegate>(library);
186             this.grpcsharp_channel_create_call = GetMethodDelegate<Delegates.grpcsharp_channel_create_call_delegate>(library);
187             this.grpcsharp_channel_check_connectivity_state = GetMethodDelegate<Delegates.grpcsharp_channel_check_connectivity_state_delegate>(library);
188             this.grpcsharp_channel_watch_connectivity_state = GetMethodDelegate<Delegates.grpcsharp_channel_watch_connectivity_state_delegate>(library);
189             this.grpcsharp_channel_get_target = GetMethodDelegate<Delegates.grpcsharp_channel_get_target_delegate>(library);
190             this.grpcsharp_channel_destroy = GetMethodDelegate<Delegates.grpcsharp_channel_destroy_delegate>(library);
191             this.grpcsharp_sizeof_grpc_event = GetMethodDelegate<Delegates.grpcsharp_sizeof_grpc_event_delegate>(library);
192             this.grpcsharp_completion_queue_create_async = GetMethodDelegate<Delegates.grpcsharp_completion_queue_create_async_delegate>(library);
193             this.grpcsharp_completion_queue_create_sync = GetMethodDelegate<Delegates.grpcsharp_completion_queue_create_sync_delegate>(library);
194             this.grpcsharp_completion_queue_shutdown = GetMethodDelegate<Delegates.grpcsharp_completion_queue_shutdown_delegate>(library);
195             this.grpcsharp_completion_queue_next = GetMethodDelegate<Delegates.grpcsharp_completion_queue_next_delegate>(library);
196             this.grpcsharp_completion_queue_pluck = GetMethodDelegate<Delegates.grpcsharp_completion_queue_pluck_delegate>(library);
197             this.grpcsharp_completion_queue_destroy = GetMethodDelegate<Delegates.grpcsharp_completion_queue_destroy_delegate>(library);
198             this.gprsharp_free = GetMethodDelegate<Delegates.gprsharp_free_delegate>(library);
199             this.grpcsharp_metadata_array_create = GetMethodDelegate<Delegates.grpcsharp_metadata_array_create_delegate>(library);
200             this.grpcsharp_metadata_array_add = GetMethodDelegate<Delegates.grpcsharp_metadata_array_add_delegate>(library);
201             this.grpcsharp_metadata_array_count = GetMethodDelegate<Delegates.grpcsharp_metadata_array_count_delegate>(library);
202             this.grpcsharp_metadata_array_get_key = GetMethodDelegate<Delegates.grpcsharp_metadata_array_get_key_delegate>(library);
203             this.grpcsharp_metadata_array_get_value = GetMethodDelegate<Delegates.grpcsharp_metadata_array_get_value_delegate>(library);
204             this.grpcsharp_metadata_array_destroy_full = GetMethodDelegate<Delegates.grpcsharp_metadata_array_destroy_full_delegate>(library);
205             this.grpcsharp_redirect_log = GetMethodDelegate<Delegates.grpcsharp_redirect_log_delegate>(library);
206             this.grpcsharp_metadata_credentials_create_from_plugin = GetMethodDelegate<Delegates.grpcsharp_metadata_credentials_create_from_plugin_delegate>(library);
207             this.grpcsharp_metadata_credentials_notify_from_plugin = GetMethodDelegate<Delegates.grpcsharp_metadata_credentials_notify_from_plugin_delegate>(library);
208             this.grpcsharp_ssl_server_credentials_create = GetMethodDelegate<Delegates.grpcsharp_ssl_server_credentials_create_delegate>(library);
209             this.grpcsharp_server_credentials_release = GetMethodDelegate<Delegates.grpcsharp_server_credentials_release_delegate>(library);
210             this.grpcsharp_server_create = GetMethodDelegate<Delegates.grpcsharp_server_create_delegate>(library);
211             this.grpcsharp_server_register_completion_queue = GetMethodDelegate<Delegates.grpcsharp_server_register_completion_queue_delegate>(library);
212             this.grpcsharp_server_add_insecure_http2_port = GetMethodDelegate<Delegates.grpcsharp_server_add_insecure_http2_port_delegate>(library);
213             this.grpcsharp_server_add_secure_http2_port = GetMethodDelegate<Delegates.grpcsharp_server_add_secure_http2_port_delegate>(library);
214             this.grpcsharp_server_start = GetMethodDelegate<Delegates.grpcsharp_server_start_delegate>(library);
215             this.grpcsharp_server_request_call = GetMethodDelegate<Delegates.grpcsharp_server_request_call_delegate>(library);
216             this.grpcsharp_server_cancel_all_calls = GetMethodDelegate<Delegates.grpcsharp_server_cancel_all_calls_delegate>(library);
217             this.grpcsharp_server_shutdown_and_notify_callback = GetMethodDelegate<Delegates.grpcsharp_server_shutdown_and_notify_callback_delegate>(library);
218             this.grpcsharp_server_destroy = GetMethodDelegate<Delegates.grpcsharp_server_destroy_delegate>(library);
219             this.grpcsharp_call_auth_context = GetMethodDelegate<Delegates.grpcsharp_call_auth_context_delegate>(library);
220             this.grpcsharp_auth_context_peer_identity_property_name = GetMethodDelegate<Delegates.grpcsharp_auth_context_peer_identity_property_name_delegate>(library);
221             this.grpcsharp_auth_context_property_iterator = GetMethodDelegate<Delegates.grpcsharp_auth_context_property_iterator_delegate>(library);
222             this.grpcsharp_auth_property_iterator_next = GetMethodDelegate<Delegates.grpcsharp_auth_property_iterator_next_delegate>(library);
223             this.grpcsharp_auth_context_release = GetMethodDelegate<Delegates.grpcsharp_auth_context_release_delegate>(library);
224             this.gprsharp_now = GetMethodDelegate<Delegates.gprsharp_now_delegate>(library);
225             this.gprsharp_inf_future = GetMethodDelegate<Delegates.gprsharp_inf_future_delegate>(library);
226             this.gprsharp_inf_past = GetMethodDelegate<Delegates.gprsharp_inf_past_delegate>(library);
227             this.gprsharp_convert_clock_type = GetMethodDelegate<Delegates.gprsharp_convert_clock_type_delegate>(library);
228             this.gprsharp_sizeof_timespec = GetMethodDelegate<Delegates.gprsharp_sizeof_timespec_delegate>(library);
229             this.grpcsharp_test_callback = GetMethodDelegate<Delegates.grpcsharp_test_callback_delegate>(library);
230             this.grpcsharp_test_nop = GetMethodDelegate<Delegates.grpcsharp_test_nop_delegate>(library);
231             this.grpcsharp_test_override_method = GetMethodDelegate<Delegates.grpcsharp_test_override_method_delegate>(library);
232         }
233 
NativeMethods(DllImportsFromStaticLib unusedInstance)234         public NativeMethods(DllImportsFromStaticLib unusedInstance)
235         {
236             this.grpcsharp_init = DllImportsFromStaticLib.grpcsharp_init;
237             this.grpcsharp_shutdown = DllImportsFromStaticLib.grpcsharp_shutdown;
238             this.grpcsharp_version_string = DllImportsFromStaticLib.grpcsharp_version_string;
239             this.grpcsharp_batch_context_create = DllImportsFromStaticLib.grpcsharp_batch_context_create;
240             this.grpcsharp_batch_context_recv_initial_metadata = DllImportsFromStaticLib.grpcsharp_batch_context_recv_initial_metadata;
241             this.grpcsharp_batch_context_recv_message_length = DllImportsFromStaticLib.grpcsharp_batch_context_recv_message_length;
242             this.grpcsharp_batch_context_recv_message_to_buffer = DllImportsFromStaticLib.grpcsharp_batch_context_recv_message_to_buffer;
243             this.grpcsharp_batch_context_recv_status_on_client_status = DllImportsFromStaticLib.grpcsharp_batch_context_recv_status_on_client_status;
244             this.grpcsharp_batch_context_recv_status_on_client_details = DllImportsFromStaticLib.grpcsharp_batch_context_recv_status_on_client_details;
245             this.grpcsharp_batch_context_recv_status_on_client_trailing_metadata = DllImportsFromStaticLib.grpcsharp_batch_context_recv_status_on_client_trailing_metadata;
246             this.grpcsharp_batch_context_recv_close_on_server_cancelled = DllImportsFromStaticLib.grpcsharp_batch_context_recv_close_on_server_cancelled;
247             this.grpcsharp_batch_context_reset = DllImportsFromStaticLib.grpcsharp_batch_context_reset;
248             this.grpcsharp_batch_context_destroy = DllImportsFromStaticLib.grpcsharp_batch_context_destroy;
249             this.grpcsharp_request_call_context_create = DllImportsFromStaticLib.grpcsharp_request_call_context_create;
250             this.grpcsharp_request_call_context_call = DllImportsFromStaticLib.grpcsharp_request_call_context_call;
251             this.grpcsharp_request_call_context_method = DllImportsFromStaticLib.grpcsharp_request_call_context_method;
252             this.grpcsharp_request_call_context_host = DllImportsFromStaticLib.grpcsharp_request_call_context_host;
253             this.grpcsharp_request_call_context_deadline = DllImportsFromStaticLib.grpcsharp_request_call_context_deadline;
254             this.grpcsharp_request_call_context_request_metadata = DllImportsFromStaticLib.grpcsharp_request_call_context_request_metadata;
255             this.grpcsharp_request_call_context_reset = DllImportsFromStaticLib.grpcsharp_request_call_context_reset;
256             this.grpcsharp_request_call_context_destroy = DllImportsFromStaticLib.grpcsharp_request_call_context_destroy;
257             this.grpcsharp_composite_call_credentials_create = DllImportsFromStaticLib.grpcsharp_composite_call_credentials_create;
258             this.grpcsharp_call_credentials_release = DllImportsFromStaticLib.grpcsharp_call_credentials_release;
259             this.grpcsharp_call_cancel = DllImportsFromStaticLib.grpcsharp_call_cancel;
260             this.grpcsharp_call_cancel_with_status = DllImportsFromStaticLib.grpcsharp_call_cancel_with_status;
261             this.grpcsharp_call_start_unary = DllImportsFromStaticLib.grpcsharp_call_start_unary;
262             this.grpcsharp_call_start_client_streaming = DllImportsFromStaticLib.grpcsharp_call_start_client_streaming;
263             this.grpcsharp_call_start_server_streaming = DllImportsFromStaticLib.grpcsharp_call_start_server_streaming;
264             this.grpcsharp_call_start_duplex_streaming = DllImportsFromStaticLib.grpcsharp_call_start_duplex_streaming;
265             this.grpcsharp_call_send_message = DllImportsFromStaticLib.grpcsharp_call_send_message;
266             this.grpcsharp_call_send_close_from_client = DllImportsFromStaticLib.grpcsharp_call_send_close_from_client;
267             this.grpcsharp_call_send_status_from_server = DllImportsFromStaticLib.grpcsharp_call_send_status_from_server;
268             this.grpcsharp_call_recv_message = DllImportsFromStaticLib.grpcsharp_call_recv_message;
269             this.grpcsharp_call_recv_initial_metadata = DllImportsFromStaticLib.grpcsharp_call_recv_initial_metadata;
270             this.grpcsharp_call_start_serverside = DllImportsFromStaticLib.grpcsharp_call_start_serverside;
271             this.grpcsharp_call_send_initial_metadata = DllImportsFromStaticLib.grpcsharp_call_send_initial_metadata;
272             this.grpcsharp_call_set_credentials = DllImportsFromStaticLib.grpcsharp_call_set_credentials;
273             this.grpcsharp_call_get_peer = DllImportsFromStaticLib.grpcsharp_call_get_peer;
274             this.grpcsharp_call_destroy = DllImportsFromStaticLib.grpcsharp_call_destroy;
275             this.grpcsharp_channel_args_create = DllImportsFromStaticLib.grpcsharp_channel_args_create;
276             this.grpcsharp_channel_args_set_string = DllImportsFromStaticLib.grpcsharp_channel_args_set_string;
277             this.grpcsharp_channel_args_set_integer = DllImportsFromStaticLib.grpcsharp_channel_args_set_integer;
278             this.grpcsharp_channel_args_destroy = DllImportsFromStaticLib.grpcsharp_channel_args_destroy;
279             this.grpcsharp_override_default_ssl_roots = DllImportsFromStaticLib.grpcsharp_override_default_ssl_roots;
280             this.grpcsharp_ssl_credentials_create = DllImportsFromStaticLib.grpcsharp_ssl_credentials_create;
281             this.grpcsharp_composite_channel_credentials_create = DllImportsFromStaticLib.grpcsharp_composite_channel_credentials_create;
282             this.grpcsharp_channel_credentials_release = DllImportsFromStaticLib.grpcsharp_channel_credentials_release;
283             this.grpcsharp_insecure_channel_create = DllImportsFromStaticLib.grpcsharp_insecure_channel_create;
284             this.grpcsharp_secure_channel_create = DllImportsFromStaticLib.grpcsharp_secure_channel_create;
285             this.grpcsharp_channel_create_call = DllImportsFromStaticLib.grpcsharp_channel_create_call;
286             this.grpcsharp_channel_check_connectivity_state = DllImportsFromStaticLib.grpcsharp_channel_check_connectivity_state;
287             this.grpcsharp_channel_watch_connectivity_state = DllImportsFromStaticLib.grpcsharp_channel_watch_connectivity_state;
288             this.grpcsharp_channel_get_target = DllImportsFromStaticLib.grpcsharp_channel_get_target;
289             this.grpcsharp_channel_destroy = DllImportsFromStaticLib.grpcsharp_channel_destroy;
290             this.grpcsharp_sizeof_grpc_event = DllImportsFromStaticLib.grpcsharp_sizeof_grpc_event;
291             this.grpcsharp_completion_queue_create_async = DllImportsFromStaticLib.grpcsharp_completion_queue_create_async;
292             this.grpcsharp_completion_queue_create_sync = DllImportsFromStaticLib.grpcsharp_completion_queue_create_sync;
293             this.grpcsharp_completion_queue_shutdown = DllImportsFromStaticLib.grpcsharp_completion_queue_shutdown;
294             this.grpcsharp_completion_queue_next = DllImportsFromStaticLib.grpcsharp_completion_queue_next;
295             this.grpcsharp_completion_queue_pluck = DllImportsFromStaticLib.grpcsharp_completion_queue_pluck;
296             this.grpcsharp_completion_queue_destroy = DllImportsFromStaticLib.grpcsharp_completion_queue_destroy;
297             this.gprsharp_free = DllImportsFromStaticLib.gprsharp_free;
298             this.grpcsharp_metadata_array_create = DllImportsFromStaticLib.grpcsharp_metadata_array_create;
299             this.grpcsharp_metadata_array_add = DllImportsFromStaticLib.grpcsharp_metadata_array_add;
300             this.grpcsharp_metadata_array_count = DllImportsFromStaticLib.grpcsharp_metadata_array_count;
301             this.grpcsharp_metadata_array_get_key = DllImportsFromStaticLib.grpcsharp_metadata_array_get_key;
302             this.grpcsharp_metadata_array_get_value = DllImportsFromStaticLib.grpcsharp_metadata_array_get_value;
303             this.grpcsharp_metadata_array_destroy_full = DllImportsFromStaticLib.grpcsharp_metadata_array_destroy_full;
304             this.grpcsharp_redirect_log = DllImportsFromStaticLib.grpcsharp_redirect_log;
305             this.grpcsharp_metadata_credentials_create_from_plugin = DllImportsFromStaticLib.grpcsharp_metadata_credentials_create_from_plugin;
306             this.grpcsharp_metadata_credentials_notify_from_plugin = DllImportsFromStaticLib.grpcsharp_metadata_credentials_notify_from_plugin;
307             this.grpcsharp_ssl_server_credentials_create = DllImportsFromStaticLib.grpcsharp_ssl_server_credentials_create;
308             this.grpcsharp_server_credentials_release = DllImportsFromStaticLib.grpcsharp_server_credentials_release;
309             this.grpcsharp_server_create = DllImportsFromStaticLib.grpcsharp_server_create;
310             this.grpcsharp_server_register_completion_queue = DllImportsFromStaticLib.grpcsharp_server_register_completion_queue;
311             this.grpcsharp_server_add_insecure_http2_port = DllImportsFromStaticLib.grpcsharp_server_add_insecure_http2_port;
312             this.grpcsharp_server_add_secure_http2_port = DllImportsFromStaticLib.grpcsharp_server_add_secure_http2_port;
313             this.grpcsharp_server_start = DllImportsFromStaticLib.grpcsharp_server_start;
314             this.grpcsharp_server_request_call = DllImportsFromStaticLib.grpcsharp_server_request_call;
315             this.grpcsharp_server_cancel_all_calls = DllImportsFromStaticLib.grpcsharp_server_cancel_all_calls;
316             this.grpcsharp_server_shutdown_and_notify_callback = DllImportsFromStaticLib.grpcsharp_server_shutdown_and_notify_callback;
317             this.grpcsharp_server_destroy = DllImportsFromStaticLib.grpcsharp_server_destroy;
318             this.grpcsharp_call_auth_context = DllImportsFromStaticLib.grpcsharp_call_auth_context;
319             this.grpcsharp_auth_context_peer_identity_property_name = DllImportsFromStaticLib.grpcsharp_auth_context_peer_identity_property_name;
320             this.grpcsharp_auth_context_property_iterator = DllImportsFromStaticLib.grpcsharp_auth_context_property_iterator;
321             this.grpcsharp_auth_property_iterator_next = DllImportsFromStaticLib.grpcsharp_auth_property_iterator_next;
322             this.grpcsharp_auth_context_release = DllImportsFromStaticLib.grpcsharp_auth_context_release;
323             this.gprsharp_now = DllImportsFromStaticLib.gprsharp_now;
324             this.gprsharp_inf_future = DllImportsFromStaticLib.gprsharp_inf_future;
325             this.gprsharp_inf_past = DllImportsFromStaticLib.gprsharp_inf_past;
326             this.gprsharp_convert_clock_type = DllImportsFromStaticLib.gprsharp_convert_clock_type;
327             this.gprsharp_sizeof_timespec = DllImportsFromStaticLib.gprsharp_sizeof_timespec;
328             this.grpcsharp_test_callback = DllImportsFromStaticLib.grpcsharp_test_callback;
329             this.grpcsharp_test_nop = DllImportsFromStaticLib.grpcsharp_test_nop;
330             this.grpcsharp_test_override_method = DllImportsFromStaticLib.grpcsharp_test_override_method;
331         }
332 
NativeMethods(DllImportsFromSharedLib unusedInstance)333         public NativeMethods(DllImportsFromSharedLib unusedInstance)
334         {
335             this.grpcsharp_init = DllImportsFromSharedLib.grpcsharp_init;
336             this.grpcsharp_shutdown = DllImportsFromSharedLib.grpcsharp_shutdown;
337             this.grpcsharp_version_string = DllImportsFromSharedLib.grpcsharp_version_string;
338             this.grpcsharp_batch_context_create = DllImportsFromSharedLib.grpcsharp_batch_context_create;
339             this.grpcsharp_batch_context_recv_initial_metadata = DllImportsFromSharedLib.grpcsharp_batch_context_recv_initial_metadata;
340             this.grpcsharp_batch_context_recv_message_length = DllImportsFromSharedLib.grpcsharp_batch_context_recv_message_length;
341             this.grpcsharp_batch_context_recv_message_to_buffer = DllImportsFromSharedLib.grpcsharp_batch_context_recv_message_to_buffer;
342             this.grpcsharp_batch_context_recv_status_on_client_status = DllImportsFromSharedLib.grpcsharp_batch_context_recv_status_on_client_status;
343             this.grpcsharp_batch_context_recv_status_on_client_details = DllImportsFromSharedLib.grpcsharp_batch_context_recv_status_on_client_details;
344             this.grpcsharp_batch_context_recv_status_on_client_trailing_metadata = DllImportsFromSharedLib.grpcsharp_batch_context_recv_status_on_client_trailing_metadata;
345             this.grpcsharp_batch_context_recv_close_on_server_cancelled = DllImportsFromSharedLib.grpcsharp_batch_context_recv_close_on_server_cancelled;
346             this.grpcsharp_batch_context_reset = DllImportsFromSharedLib.grpcsharp_batch_context_reset;
347             this.grpcsharp_batch_context_destroy = DllImportsFromSharedLib.grpcsharp_batch_context_destroy;
348             this.grpcsharp_request_call_context_create = DllImportsFromSharedLib.grpcsharp_request_call_context_create;
349             this.grpcsharp_request_call_context_call = DllImportsFromSharedLib.grpcsharp_request_call_context_call;
350             this.grpcsharp_request_call_context_method = DllImportsFromSharedLib.grpcsharp_request_call_context_method;
351             this.grpcsharp_request_call_context_host = DllImportsFromSharedLib.grpcsharp_request_call_context_host;
352             this.grpcsharp_request_call_context_deadline = DllImportsFromSharedLib.grpcsharp_request_call_context_deadline;
353             this.grpcsharp_request_call_context_request_metadata = DllImportsFromSharedLib.grpcsharp_request_call_context_request_metadata;
354             this.grpcsharp_request_call_context_reset = DllImportsFromSharedLib.grpcsharp_request_call_context_reset;
355             this.grpcsharp_request_call_context_destroy = DllImportsFromSharedLib.grpcsharp_request_call_context_destroy;
356             this.grpcsharp_composite_call_credentials_create = DllImportsFromSharedLib.grpcsharp_composite_call_credentials_create;
357             this.grpcsharp_call_credentials_release = DllImportsFromSharedLib.grpcsharp_call_credentials_release;
358             this.grpcsharp_call_cancel = DllImportsFromSharedLib.grpcsharp_call_cancel;
359             this.grpcsharp_call_cancel_with_status = DllImportsFromSharedLib.grpcsharp_call_cancel_with_status;
360             this.grpcsharp_call_start_unary = DllImportsFromSharedLib.grpcsharp_call_start_unary;
361             this.grpcsharp_call_start_client_streaming = DllImportsFromSharedLib.grpcsharp_call_start_client_streaming;
362             this.grpcsharp_call_start_server_streaming = DllImportsFromSharedLib.grpcsharp_call_start_server_streaming;
363             this.grpcsharp_call_start_duplex_streaming = DllImportsFromSharedLib.grpcsharp_call_start_duplex_streaming;
364             this.grpcsharp_call_send_message = DllImportsFromSharedLib.grpcsharp_call_send_message;
365             this.grpcsharp_call_send_close_from_client = DllImportsFromSharedLib.grpcsharp_call_send_close_from_client;
366             this.grpcsharp_call_send_status_from_server = DllImportsFromSharedLib.grpcsharp_call_send_status_from_server;
367             this.grpcsharp_call_recv_message = DllImportsFromSharedLib.grpcsharp_call_recv_message;
368             this.grpcsharp_call_recv_initial_metadata = DllImportsFromSharedLib.grpcsharp_call_recv_initial_metadata;
369             this.grpcsharp_call_start_serverside = DllImportsFromSharedLib.grpcsharp_call_start_serverside;
370             this.grpcsharp_call_send_initial_metadata = DllImportsFromSharedLib.grpcsharp_call_send_initial_metadata;
371             this.grpcsharp_call_set_credentials = DllImportsFromSharedLib.grpcsharp_call_set_credentials;
372             this.grpcsharp_call_get_peer = DllImportsFromSharedLib.grpcsharp_call_get_peer;
373             this.grpcsharp_call_destroy = DllImportsFromSharedLib.grpcsharp_call_destroy;
374             this.grpcsharp_channel_args_create = DllImportsFromSharedLib.grpcsharp_channel_args_create;
375             this.grpcsharp_channel_args_set_string = DllImportsFromSharedLib.grpcsharp_channel_args_set_string;
376             this.grpcsharp_channel_args_set_integer = DllImportsFromSharedLib.grpcsharp_channel_args_set_integer;
377             this.grpcsharp_channel_args_destroy = DllImportsFromSharedLib.grpcsharp_channel_args_destroy;
378             this.grpcsharp_override_default_ssl_roots = DllImportsFromSharedLib.grpcsharp_override_default_ssl_roots;
379             this.grpcsharp_ssl_credentials_create = DllImportsFromSharedLib.grpcsharp_ssl_credentials_create;
380             this.grpcsharp_composite_channel_credentials_create = DllImportsFromSharedLib.grpcsharp_composite_channel_credentials_create;
381             this.grpcsharp_channel_credentials_release = DllImportsFromSharedLib.grpcsharp_channel_credentials_release;
382             this.grpcsharp_insecure_channel_create = DllImportsFromSharedLib.grpcsharp_insecure_channel_create;
383             this.grpcsharp_secure_channel_create = DllImportsFromSharedLib.grpcsharp_secure_channel_create;
384             this.grpcsharp_channel_create_call = DllImportsFromSharedLib.grpcsharp_channel_create_call;
385             this.grpcsharp_channel_check_connectivity_state = DllImportsFromSharedLib.grpcsharp_channel_check_connectivity_state;
386             this.grpcsharp_channel_watch_connectivity_state = DllImportsFromSharedLib.grpcsharp_channel_watch_connectivity_state;
387             this.grpcsharp_channel_get_target = DllImportsFromSharedLib.grpcsharp_channel_get_target;
388             this.grpcsharp_channel_destroy = DllImportsFromSharedLib.grpcsharp_channel_destroy;
389             this.grpcsharp_sizeof_grpc_event = DllImportsFromSharedLib.grpcsharp_sizeof_grpc_event;
390             this.grpcsharp_completion_queue_create_async = DllImportsFromSharedLib.grpcsharp_completion_queue_create_async;
391             this.grpcsharp_completion_queue_create_sync = DllImportsFromSharedLib.grpcsharp_completion_queue_create_sync;
392             this.grpcsharp_completion_queue_shutdown = DllImportsFromSharedLib.grpcsharp_completion_queue_shutdown;
393             this.grpcsharp_completion_queue_next = DllImportsFromSharedLib.grpcsharp_completion_queue_next;
394             this.grpcsharp_completion_queue_pluck = DllImportsFromSharedLib.grpcsharp_completion_queue_pluck;
395             this.grpcsharp_completion_queue_destroy = DllImportsFromSharedLib.grpcsharp_completion_queue_destroy;
396             this.gprsharp_free = DllImportsFromSharedLib.gprsharp_free;
397             this.grpcsharp_metadata_array_create = DllImportsFromSharedLib.grpcsharp_metadata_array_create;
398             this.grpcsharp_metadata_array_add = DllImportsFromSharedLib.grpcsharp_metadata_array_add;
399             this.grpcsharp_metadata_array_count = DllImportsFromSharedLib.grpcsharp_metadata_array_count;
400             this.grpcsharp_metadata_array_get_key = DllImportsFromSharedLib.grpcsharp_metadata_array_get_key;
401             this.grpcsharp_metadata_array_get_value = DllImportsFromSharedLib.grpcsharp_metadata_array_get_value;
402             this.grpcsharp_metadata_array_destroy_full = DllImportsFromSharedLib.grpcsharp_metadata_array_destroy_full;
403             this.grpcsharp_redirect_log = DllImportsFromSharedLib.grpcsharp_redirect_log;
404             this.grpcsharp_metadata_credentials_create_from_plugin = DllImportsFromSharedLib.grpcsharp_metadata_credentials_create_from_plugin;
405             this.grpcsharp_metadata_credentials_notify_from_plugin = DllImportsFromSharedLib.grpcsharp_metadata_credentials_notify_from_plugin;
406             this.grpcsharp_ssl_server_credentials_create = DllImportsFromSharedLib.grpcsharp_ssl_server_credentials_create;
407             this.grpcsharp_server_credentials_release = DllImportsFromSharedLib.grpcsharp_server_credentials_release;
408             this.grpcsharp_server_create = DllImportsFromSharedLib.grpcsharp_server_create;
409             this.grpcsharp_server_register_completion_queue = DllImportsFromSharedLib.grpcsharp_server_register_completion_queue;
410             this.grpcsharp_server_add_insecure_http2_port = DllImportsFromSharedLib.grpcsharp_server_add_insecure_http2_port;
411             this.grpcsharp_server_add_secure_http2_port = DllImportsFromSharedLib.grpcsharp_server_add_secure_http2_port;
412             this.grpcsharp_server_start = DllImportsFromSharedLib.grpcsharp_server_start;
413             this.grpcsharp_server_request_call = DllImportsFromSharedLib.grpcsharp_server_request_call;
414             this.grpcsharp_server_cancel_all_calls = DllImportsFromSharedLib.grpcsharp_server_cancel_all_calls;
415             this.grpcsharp_server_shutdown_and_notify_callback = DllImportsFromSharedLib.grpcsharp_server_shutdown_and_notify_callback;
416             this.grpcsharp_server_destroy = DllImportsFromSharedLib.grpcsharp_server_destroy;
417             this.grpcsharp_call_auth_context = DllImportsFromSharedLib.grpcsharp_call_auth_context;
418             this.grpcsharp_auth_context_peer_identity_property_name = DllImportsFromSharedLib.grpcsharp_auth_context_peer_identity_property_name;
419             this.grpcsharp_auth_context_property_iterator = DllImportsFromSharedLib.grpcsharp_auth_context_property_iterator;
420             this.grpcsharp_auth_property_iterator_next = DllImportsFromSharedLib.grpcsharp_auth_property_iterator_next;
421             this.grpcsharp_auth_context_release = DllImportsFromSharedLib.grpcsharp_auth_context_release;
422             this.gprsharp_now = DllImportsFromSharedLib.gprsharp_now;
423             this.gprsharp_inf_future = DllImportsFromSharedLib.gprsharp_inf_future;
424             this.gprsharp_inf_past = DllImportsFromSharedLib.gprsharp_inf_past;
425             this.gprsharp_convert_clock_type = DllImportsFromSharedLib.gprsharp_convert_clock_type;
426             this.gprsharp_sizeof_timespec = DllImportsFromSharedLib.gprsharp_sizeof_timespec;
427             this.grpcsharp_test_callback = DllImportsFromSharedLib.grpcsharp_test_callback;
428             this.grpcsharp_test_nop = DllImportsFromSharedLib.grpcsharp_test_nop;
429             this.grpcsharp_test_override_method = DllImportsFromSharedLib.grpcsharp_test_override_method;
430         }
431 
432         /// <summary>
433         /// Delegate types for all published native methods. Declared under inner class to prevent scope pollution.
434         /// </summary>
435         public class Delegates
436         {
grpcsharp_init_delegate()437             public delegate void grpcsharp_init_delegate();
grpcsharp_shutdown_delegate()438             public delegate void grpcsharp_shutdown_delegate();
grpcsharp_version_string_delegate()439             public delegate IntPtr grpcsharp_version_string_delegate();  // returns not-owned const char*
grpcsharp_batch_context_create_delegate()440             public delegate BatchContextSafeHandle grpcsharp_batch_context_create_delegate();
grpcsharp_batch_context_recv_initial_metadata_delegate(BatchContextSafeHandle ctx)441             public delegate IntPtr grpcsharp_batch_context_recv_initial_metadata_delegate(BatchContextSafeHandle ctx);
grpcsharp_batch_context_recv_message_length_delegate(BatchContextSafeHandle ctx)442             public delegate IntPtr grpcsharp_batch_context_recv_message_length_delegate(BatchContextSafeHandle ctx);
grpcsharp_batch_context_recv_message_to_buffer_delegate(BatchContextSafeHandle ctx, byte[] buffer, UIntPtr bufferLen)443             public delegate void grpcsharp_batch_context_recv_message_to_buffer_delegate(BatchContextSafeHandle ctx, byte[] buffer, UIntPtr bufferLen);
grpcsharp_batch_context_recv_status_on_client_status_delegate(BatchContextSafeHandle ctx)444             public delegate StatusCode grpcsharp_batch_context_recv_status_on_client_status_delegate(BatchContextSafeHandle ctx);
grpcsharp_batch_context_recv_status_on_client_details_delegate(BatchContextSafeHandle ctx, out UIntPtr detailsLength)445             public delegate IntPtr grpcsharp_batch_context_recv_status_on_client_details_delegate(BatchContextSafeHandle ctx, out UIntPtr detailsLength);
grpcsharp_batch_context_recv_status_on_client_trailing_metadata_delegate(BatchContextSafeHandle ctx)446             public delegate IntPtr grpcsharp_batch_context_recv_status_on_client_trailing_metadata_delegate(BatchContextSafeHandle ctx);
grpcsharp_batch_context_recv_close_on_server_cancelled_delegate(BatchContextSafeHandle ctx)447             public delegate int grpcsharp_batch_context_recv_close_on_server_cancelled_delegate(BatchContextSafeHandle ctx);
grpcsharp_batch_context_reset_delegate(BatchContextSafeHandle ctx)448             public delegate void grpcsharp_batch_context_reset_delegate(BatchContextSafeHandle ctx);
grpcsharp_batch_context_destroy_delegate(IntPtr ctx)449             public delegate void grpcsharp_batch_context_destroy_delegate(IntPtr ctx);
grpcsharp_request_call_context_create_delegate()450             public delegate RequestCallContextSafeHandle grpcsharp_request_call_context_create_delegate();
grpcsharp_request_call_context_call_delegate(RequestCallContextSafeHandle ctx)451             public delegate CallSafeHandle grpcsharp_request_call_context_call_delegate(RequestCallContextSafeHandle ctx);
grpcsharp_request_call_context_method_delegate(RequestCallContextSafeHandle ctx, out UIntPtr methodLength)452             public delegate IntPtr grpcsharp_request_call_context_method_delegate(RequestCallContextSafeHandle ctx, out UIntPtr methodLength);
grpcsharp_request_call_context_host_delegate(RequestCallContextSafeHandle ctx, out UIntPtr hostLength)453             public delegate IntPtr grpcsharp_request_call_context_host_delegate(RequestCallContextSafeHandle ctx, out UIntPtr hostLength);
grpcsharp_request_call_context_deadline_delegate(RequestCallContextSafeHandle ctx)454             public delegate Timespec grpcsharp_request_call_context_deadline_delegate(RequestCallContextSafeHandle ctx);
grpcsharp_request_call_context_request_metadata_delegate(RequestCallContextSafeHandle ctx)455             public delegate IntPtr grpcsharp_request_call_context_request_metadata_delegate(RequestCallContextSafeHandle ctx);
grpcsharp_request_call_context_reset_delegate(RequestCallContextSafeHandle ctx)456             public delegate void grpcsharp_request_call_context_reset_delegate(RequestCallContextSafeHandle ctx);
grpcsharp_request_call_context_destroy_delegate(IntPtr ctx)457             public delegate void grpcsharp_request_call_context_destroy_delegate(IntPtr ctx);
grpcsharp_composite_call_credentials_create_delegate(CallCredentialsSafeHandle creds1, CallCredentialsSafeHandle creds2)458             public delegate CallCredentialsSafeHandle grpcsharp_composite_call_credentials_create_delegate(CallCredentialsSafeHandle creds1, CallCredentialsSafeHandle creds2);
grpcsharp_call_credentials_release_delegate(IntPtr credentials)459             public delegate void grpcsharp_call_credentials_release_delegate(IntPtr credentials);
grpcsharp_call_cancel_delegate(CallSafeHandle call)460             public delegate CallError grpcsharp_call_cancel_delegate(CallSafeHandle call);
grpcsharp_call_cancel_with_status_delegate(CallSafeHandle call, StatusCode status, string description)461             public delegate CallError grpcsharp_call_cancel_with_status_delegate(CallSafeHandle call, StatusCode status, string description);
grpcsharp_call_start_unary_delegate(CallSafeHandle call, BatchContextSafeHandle ctx, byte[] sendBuffer, UIntPtr sendBufferLen, WriteFlags writeFlags, MetadataArraySafeHandle metadataArray, CallFlags metadataFlags)462             public delegate CallError grpcsharp_call_start_unary_delegate(CallSafeHandle call, BatchContextSafeHandle ctx, byte[] sendBuffer, UIntPtr sendBufferLen, WriteFlags writeFlags, MetadataArraySafeHandle metadataArray, CallFlags metadataFlags);
grpcsharp_call_start_client_streaming_delegate(CallSafeHandle call, BatchContextSafeHandle ctx, MetadataArraySafeHandle metadataArray, CallFlags metadataFlags)463             public delegate CallError grpcsharp_call_start_client_streaming_delegate(CallSafeHandle call, BatchContextSafeHandle ctx, MetadataArraySafeHandle metadataArray, CallFlags metadataFlags);
grpcsharp_call_start_server_streaming_delegate(CallSafeHandle call, BatchContextSafeHandle ctx, byte[] sendBuffer, UIntPtr sendBufferLen, WriteFlags writeFlags, MetadataArraySafeHandle metadataArray, CallFlags metadataFlags)464             public delegate CallError grpcsharp_call_start_server_streaming_delegate(CallSafeHandle call, BatchContextSafeHandle ctx, byte[] sendBuffer, UIntPtr sendBufferLen, WriteFlags writeFlags, MetadataArraySafeHandle metadataArray, CallFlags metadataFlags);
grpcsharp_call_start_duplex_streaming_delegate(CallSafeHandle call, BatchContextSafeHandle ctx, MetadataArraySafeHandle metadataArray, CallFlags metadataFlags)465             public delegate CallError grpcsharp_call_start_duplex_streaming_delegate(CallSafeHandle call, BatchContextSafeHandle ctx, MetadataArraySafeHandle metadataArray, CallFlags metadataFlags);
grpcsharp_call_send_message_delegate(CallSafeHandle call, BatchContextSafeHandle ctx, byte[] sendBuffer, UIntPtr sendBufferLen, WriteFlags writeFlags, int sendEmptyInitialMetadata)466             public delegate CallError grpcsharp_call_send_message_delegate(CallSafeHandle call, BatchContextSafeHandle ctx, byte[] sendBuffer, UIntPtr sendBufferLen, WriteFlags writeFlags, int sendEmptyInitialMetadata);
grpcsharp_call_send_close_from_client_delegate(CallSafeHandle call, BatchContextSafeHandle ctx)467             public delegate CallError grpcsharp_call_send_close_from_client_delegate(CallSafeHandle call, BatchContextSafeHandle ctx);
grpcsharp_call_send_status_from_server_delegate(CallSafeHandle call, BatchContextSafeHandle ctx, StatusCode statusCode, byte[] statusMessage, UIntPtr statusMessageLen, MetadataArraySafeHandle metadataArray, int sendEmptyInitialMetadata, byte[] optionalSendBuffer, UIntPtr optionalSendBufferLen, WriteFlags writeFlags)468             public delegate CallError grpcsharp_call_send_status_from_server_delegate(CallSafeHandle call, BatchContextSafeHandle ctx, StatusCode statusCode, byte[] statusMessage, UIntPtr statusMessageLen, MetadataArraySafeHandle metadataArray, int sendEmptyInitialMetadata, byte[] optionalSendBuffer, UIntPtr optionalSendBufferLen, WriteFlags writeFlags);
grpcsharp_call_recv_message_delegate(CallSafeHandle call, BatchContextSafeHandle ctx)469             public delegate CallError grpcsharp_call_recv_message_delegate(CallSafeHandle call, BatchContextSafeHandle ctx);
grpcsharp_call_recv_initial_metadata_delegate(CallSafeHandle call, BatchContextSafeHandle ctx)470             public delegate CallError grpcsharp_call_recv_initial_metadata_delegate(CallSafeHandle call, BatchContextSafeHandle ctx);
grpcsharp_call_start_serverside_delegate(CallSafeHandle call, BatchContextSafeHandle ctx)471             public delegate CallError grpcsharp_call_start_serverside_delegate(CallSafeHandle call, BatchContextSafeHandle ctx);
grpcsharp_call_send_initial_metadata_delegate(CallSafeHandle call, BatchContextSafeHandle ctx, MetadataArraySafeHandle metadataArray)472             public delegate CallError grpcsharp_call_send_initial_metadata_delegate(CallSafeHandle call, BatchContextSafeHandle ctx, MetadataArraySafeHandle metadataArray);
grpcsharp_call_set_credentials_delegate(CallSafeHandle call, CallCredentialsSafeHandle credentials)473             public delegate CallError grpcsharp_call_set_credentials_delegate(CallSafeHandle call, CallCredentialsSafeHandle credentials);
grpcsharp_call_get_peer_delegate(CallSafeHandle call)474             public delegate CStringSafeHandle grpcsharp_call_get_peer_delegate(CallSafeHandle call);
grpcsharp_call_destroy_delegate(IntPtr call)475             public delegate void grpcsharp_call_destroy_delegate(IntPtr call);
grpcsharp_channel_args_create_delegate(UIntPtr numArgs)476             public delegate ChannelArgsSafeHandle grpcsharp_channel_args_create_delegate(UIntPtr numArgs);
grpcsharp_channel_args_set_string_delegate(ChannelArgsSafeHandle args, UIntPtr index, string key, string value)477             public delegate void grpcsharp_channel_args_set_string_delegate(ChannelArgsSafeHandle args, UIntPtr index, string key, string value);
grpcsharp_channel_args_set_integer_delegate(ChannelArgsSafeHandle args, UIntPtr index, string key, int value)478             public delegate void grpcsharp_channel_args_set_integer_delegate(ChannelArgsSafeHandle args, UIntPtr index, string key, int value);
grpcsharp_channel_args_destroy_delegate(IntPtr args)479             public delegate void grpcsharp_channel_args_destroy_delegate(IntPtr args);
grpcsharp_override_default_ssl_roots_delegate(string pemRootCerts)480             public delegate void grpcsharp_override_default_ssl_roots_delegate(string pemRootCerts);
grpcsharp_ssl_credentials_create_delegate(string pemRootCerts, string keyCertPairCertChain, string keyCertPairPrivateKey)481             public delegate ChannelCredentialsSafeHandle grpcsharp_ssl_credentials_create_delegate(string pemRootCerts, string keyCertPairCertChain, string keyCertPairPrivateKey);
grpcsharp_composite_channel_credentials_create_delegate(ChannelCredentialsSafeHandle channelCreds, CallCredentialsSafeHandle callCreds)482             public delegate ChannelCredentialsSafeHandle grpcsharp_composite_channel_credentials_create_delegate(ChannelCredentialsSafeHandle channelCreds, CallCredentialsSafeHandle callCreds);
grpcsharp_channel_credentials_release_delegate(IntPtr credentials)483             public delegate void grpcsharp_channel_credentials_release_delegate(IntPtr credentials);
grpcsharp_insecure_channel_create_delegate(string target, ChannelArgsSafeHandle channelArgs)484             public delegate ChannelSafeHandle grpcsharp_insecure_channel_create_delegate(string target, ChannelArgsSafeHandle channelArgs);
grpcsharp_secure_channel_create_delegate(ChannelCredentialsSafeHandle credentials, string target, ChannelArgsSafeHandle channelArgs)485             public delegate ChannelSafeHandle grpcsharp_secure_channel_create_delegate(ChannelCredentialsSafeHandle credentials, string target, ChannelArgsSafeHandle channelArgs);
grpcsharp_channel_create_call_delegate(ChannelSafeHandle channel, CallSafeHandle parentCall, ContextPropagationFlags propagationMask, CompletionQueueSafeHandle cq, string method, string host, Timespec deadline)486             public delegate CallSafeHandle grpcsharp_channel_create_call_delegate(ChannelSafeHandle channel, CallSafeHandle parentCall, ContextPropagationFlags propagationMask, CompletionQueueSafeHandle cq, string method, string host, Timespec deadline);
grpcsharp_channel_check_connectivity_state_delegate(ChannelSafeHandle channel, int tryToConnect)487             public delegate ChannelState grpcsharp_channel_check_connectivity_state_delegate(ChannelSafeHandle channel, int tryToConnect);
grpcsharp_channel_watch_connectivity_state_delegate(ChannelSafeHandle channel, ChannelState lastObservedState, Timespec deadline, CompletionQueueSafeHandle cq, BatchContextSafeHandle ctx)488             public delegate void grpcsharp_channel_watch_connectivity_state_delegate(ChannelSafeHandle channel, ChannelState lastObservedState, Timespec deadline, CompletionQueueSafeHandle cq, BatchContextSafeHandle ctx);
grpcsharp_channel_get_target_delegate(ChannelSafeHandle call)489             public delegate CStringSafeHandle grpcsharp_channel_get_target_delegate(ChannelSafeHandle call);
grpcsharp_channel_destroy_delegate(IntPtr channel)490             public delegate void grpcsharp_channel_destroy_delegate(IntPtr channel);
grpcsharp_sizeof_grpc_event_delegate()491             public delegate int grpcsharp_sizeof_grpc_event_delegate();
grpcsharp_completion_queue_create_async_delegate()492             public delegate CompletionQueueSafeHandle grpcsharp_completion_queue_create_async_delegate();
grpcsharp_completion_queue_create_sync_delegate()493             public delegate CompletionQueueSafeHandle grpcsharp_completion_queue_create_sync_delegate();
grpcsharp_completion_queue_shutdown_delegate(CompletionQueueSafeHandle cq)494             public delegate void grpcsharp_completion_queue_shutdown_delegate(CompletionQueueSafeHandle cq);
grpcsharp_completion_queue_next_delegate(CompletionQueueSafeHandle cq)495             public delegate CompletionQueueEvent grpcsharp_completion_queue_next_delegate(CompletionQueueSafeHandle cq);
grpcsharp_completion_queue_pluck_delegate(CompletionQueueSafeHandle cq, IntPtr tag)496             public delegate CompletionQueueEvent grpcsharp_completion_queue_pluck_delegate(CompletionQueueSafeHandle cq, IntPtr tag);
grpcsharp_completion_queue_destroy_delegate(IntPtr cq)497             public delegate void grpcsharp_completion_queue_destroy_delegate(IntPtr cq);
gprsharp_free_delegate(IntPtr ptr)498             public delegate void gprsharp_free_delegate(IntPtr ptr);
grpcsharp_metadata_array_create_delegate(UIntPtr capacity)499             public delegate MetadataArraySafeHandle grpcsharp_metadata_array_create_delegate(UIntPtr capacity);
grpcsharp_metadata_array_add_delegate(MetadataArraySafeHandle array, string key, byte[] value, UIntPtr valueLength)500             public delegate void grpcsharp_metadata_array_add_delegate(MetadataArraySafeHandle array, string key, byte[] value, UIntPtr valueLength);
grpcsharp_metadata_array_count_delegate(IntPtr metadataArray)501             public delegate UIntPtr grpcsharp_metadata_array_count_delegate(IntPtr metadataArray);
grpcsharp_metadata_array_get_key_delegate(IntPtr metadataArray, UIntPtr index, out UIntPtr keyLength)502             public delegate IntPtr grpcsharp_metadata_array_get_key_delegate(IntPtr metadataArray, UIntPtr index, out UIntPtr keyLength);
grpcsharp_metadata_array_get_value_delegate(IntPtr metadataArray, UIntPtr index, out UIntPtr valueLength)503             public delegate IntPtr grpcsharp_metadata_array_get_value_delegate(IntPtr metadataArray, UIntPtr index, out UIntPtr valueLength);
grpcsharp_metadata_array_destroy_full_delegate(IntPtr array)504             public delegate void grpcsharp_metadata_array_destroy_full_delegate(IntPtr array);
grpcsharp_redirect_log_delegate(GprLogDelegate callback)505             public delegate void grpcsharp_redirect_log_delegate(GprLogDelegate callback);
grpcsharp_metadata_credentials_create_from_plugin_delegate(NativeMetadataInterceptor interceptor)506             public delegate CallCredentialsSafeHandle grpcsharp_metadata_credentials_create_from_plugin_delegate(NativeMetadataInterceptor interceptor);
grpcsharp_metadata_credentials_notify_from_plugin_delegate(IntPtr callbackPtr, IntPtr userData, MetadataArraySafeHandle metadataArray, StatusCode statusCode, string errorDetails)507             public delegate void grpcsharp_metadata_credentials_notify_from_plugin_delegate(IntPtr callbackPtr, IntPtr userData, MetadataArraySafeHandle metadataArray, StatusCode statusCode, string errorDetails);
grpcsharp_ssl_server_credentials_create_delegate(string pemRootCerts, string[] keyCertPairCertChainArray, string[] keyCertPairPrivateKeyArray, UIntPtr numKeyCertPairs, int forceClientAuth)508             public delegate ServerCredentialsSafeHandle grpcsharp_ssl_server_credentials_create_delegate(string pemRootCerts, string[] keyCertPairCertChainArray, string[] keyCertPairPrivateKeyArray, UIntPtr numKeyCertPairs, int forceClientAuth);
grpcsharp_server_credentials_release_delegate(IntPtr credentials)509             public delegate void grpcsharp_server_credentials_release_delegate(IntPtr credentials);
grpcsharp_server_create_delegate(ChannelArgsSafeHandle args)510             public delegate ServerSafeHandle grpcsharp_server_create_delegate(ChannelArgsSafeHandle args);
grpcsharp_server_register_completion_queue_delegate(ServerSafeHandle server, CompletionQueueSafeHandle cq)511             public delegate void grpcsharp_server_register_completion_queue_delegate(ServerSafeHandle server, CompletionQueueSafeHandle cq);
grpcsharp_server_add_insecure_http2_port_delegate(ServerSafeHandle server, string addr)512             public delegate int grpcsharp_server_add_insecure_http2_port_delegate(ServerSafeHandle server, string addr);
grpcsharp_server_add_secure_http2_port_delegate(ServerSafeHandle server, string addr, ServerCredentialsSafeHandle creds)513             public delegate int grpcsharp_server_add_secure_http2_port_delegate(ServerSafeHandle server, string addr, ServerCredentialsSafeHandle creds);
grpcsharp_server_start_delegate(ServerSafeHandle server)514             public delegate void grpcsharp_server_start_delegate(ServerSafeHandle server);
grpcsharp_server_request_call_delegate(ServerSafeHandle server, CompletionQueueSafeHandle cq, RequestCallContextSafeHandle ctx)515             public delegate CallError grpcsharp_server_request_call_delegate(ServerSafeHandle server, CompletionQueueSafeHandle cq, RequestCallContextSafeHandle ctx);
grpcsharp_server_cancel_all_calls_delegate(ServerSafeHandle server)516             public delegate void grpcsharp_server_cancel_all_calls_delegate(ServerSafeHandle server);
grpcsharp_server_shutdown_and_notify_callback_delegate(ServerSafeHandle server, CompletionQueueSafeHandle cq, BatchContextSafeHandle ctx)517             public delegate void grpcsharp_server_shutdown_and_notify_callback_delegate(ServerSafeHandle server, CompletionQueueSafeHandle cq, BatchContextSafeHandle ctx);
grpcsharp_server_destroy_delegate(IntPtr server)518             public delegate void grpcsharp_server_destroy_delegate(IntPtr server);
grpcsharp_call_auth_context_delegate(CallSafeHandle call)519             public delegate AuthContextSafeHandle grpcsharp_call_auth_context_delegate(CallSafeHandle call);
grpcsharp_auth_context_peer_identity_property_name_delegate(AuthContextSafeHandle authContext)520             public delegate IntPtr grpcsharp_auth_context_peer_identity_property_name_delegate(AuthContextSafeHandle authContext);  // returns const char*
grpcsharp_auth_context_property_iterator_delegate(AuthContextSafeHandle authContext)521             public delegate AuthContextSafeHandle.NativeAuthPropertyIterator grpcsharp_auth_context_property_iterator_delegate(AuthContextSafeHandle authContext);
grpcsharp_auth_property_iterator_next_delegate(ref AuthContextSafeHandle.NativeAuthPropertyIterator iterator)522             public delegate IntPtr grpcsharp_auth_property_iterator_next_delegate(ref AuthContextSafeHandle.NativeAuthPropertyIterator iterator);  // returns const auth_property*
grpcsharp_auth_context_release_delegate(IntPtr authContext)523             public delegate void grpcsharp_auth_context_release_delegate(IntPtr authContext);
gprsharp_now_delegate(ClockType clockType)524             public delegate Timespec gprsharp_now_delegate(ClockType clockType);
gprsharp_inf_future_delegate(ClockType clockType)525             public delegate Timespec gprsharp_inf_future_delegate(ClockType clockType);
gprsharp_inf_past_delegate(ClockType clockType)526             public delegate Timespec gprsharp_inf_past_delegate(ClockType clockType);
gprsharp_convert_clock_type_delegate(Timespec t, ClockType targetClock)527             public delegate Timespec gprsharp_convert_clock_type_delegate(Timespec t, ClockType targetClock);
gprsharp_sizeof_timespec_delegate()528             public delegate int gprsharp_sizeof_timespec_delegate();
grpcsharp_test_callback_delegate([MarshalAs(UnmanagedType.FunctionPtr)] NativeCallbackTestDelegate callback)529             public delegate CallError grpcsharp_test_callback_delegate([MarshalAs(UnmanagedType.FunctionPtr)] NativeCallbackTestDelegate callback);
grpcsharp_test_nop_delegate(IntPtr ptr)530             public delegate IntPtr grpcsharp_test_nop_delegate(IntPtr ptr);
grpcsharp_test_override_method_delegate(string methodName, string variant)531             public delegate void grpcsharp_test_override_method_delegate(string methodName, string variant);
532         }
533 
534         /// <summary>
535         /// grpc_csharp_ext used as a static library (e.g Unity iOS).
536         /// </summary>
537         internal class DllImportsFromStaticLib
538         {
539             private const string ImportName = "__Internal";
540 
541             [DllImport(ImportName)]
grpcsharp_init()542             public static extern void grpcsharp_init();
543 
544             [DllImport(ImportName)]
grpcsharp_shutdown()545             public static extern void grpcsharp_shutdown();
546 
547             [DllImport(ImportName)]
grpcsharp_version_string()548             public static extern IntPtr grpcsharp_version_string();
549 
550             [DllImport(ImportName)]
grpcsharp_batch_context_create()551             public static extern BatchContextSafeHandle grpcsharp_batch_context_create();
552 
553             [DllImport(ImportName)]
grpcsharp_batch_context_recv_initial_metadata(BatchContextSafeHandle ctx)554             public static extern IntPtr grpcsharp_batch_context_recv_initial_metadata(BatchContextSafeHandle ctx);
555 
556             [DllImport(ImportName)]
grpcsharp_batch_context_recv_message_length(BatchContextSafeHandle ctx)557             public static extern IntPtr grpcsharp_batch_context_recv_message_length(BatchContextSafeHandle ctx);
558 
559             [DllImport(ImportName)]
grpcsharp_batch_context_recv_message_to_buffer(BatchContextSafeHandle ctx, byte[] buffer, UIntPtr bufferLen)560             public static extern void grpcsharp_batch_context_recv_message_to_buffer(BatchContextSafeHandle ctx, byte[] buffer, UIntPtr bufferLen);
561 
562             [DllImport(ImportName)]
grpcsharp_batch_context_recv_status_on_client_status(BatchContextSafeHandle ctx)563             public static extern StatusCode grpcsharp_batch_context_recv_status_on_client_status(BatchContextSafeHandle ctx);
564 
565             [DllImport(ImportName)]
grpcsharp_batch_context_recv_status_on_client_details(BatchContextSafeHandle ctx, out UIntPtr detailsLength)566             public static extern IntPtr grpcsharp_batch_context_recv_status_on_client_details(BatchContextSafeHandle ctx, out UIntPtr detailsLength);
567 
568             [DllImport(ImportName)]
grpcsharp_batch_context_recv_status_on_client_trailing_metadata(BatchContextSafeHandle ctx)569             public static extern IntPtr grpcsharp_batch_context_recv_status_on_client_trailing_metadata(BatchContextSafeHandle ctx);
570 
571             [DllImport(ImportName)]
grpcsharp_batch_context_recv_close_on_server_cancelled(BatchContextSafeHandle ctx)572             public static extern int grpcsharp_batch_context_recv_close_on_server_cancelled(BatchContextSafeHandle ctx);
573 
574             [DllImport(ImportName)]
grpcsharp_batch_context_reset(BatchContextSafeHandle ctx)575             public static extern void grpcsharp_batch_context_reset(BatchContextSafeHandle ctx);
576 
577             [DllImport(ImportName)]
grpcsharp_batch_context_destroy(IntPtr ctx)578             public static extern void grpcsharp_batch_context_destroy(IntPtr ctx);
579 
580             [DllImport(ImportName)]
grpcsharp_request_call_context_create()581             public static extern RequestCallContextSafeHandle grpcsharp_request_call_context_create();
582 
583             [DllImport(ImportName)]
grpcsharp_request_call_context_call(RequestCallContextSafeHandle ctx)584             public static extern CallSafeHandle grpcsharp_request_call_context_call(RequestCallContextSafeHandle ctx);
585 
586             [DllImport(ImportName)]
grpcsharp_request_call_context_method(RequestCallContextSafeHandle ctx, out UIntPtr methodLength)587             public static extern IntPtr grpcsharp_request_call_context_method(RequestCallContextSafeHandle ctx, out UIntPtr methodLength);
588 
589             [DllImport(ImportName)]
grpcsharp_request_call_context_host(RequestCallContextSafeHandle ctx, out UIntPtr hostLength)590             public static extern IntPtr grpcsharp_request_call_context_host(RequestCallContextSafeHandle ctx, out UIntPtr hostLength);
591 
592             [DllImport(ImportName)]
grpcsharp_request_call_context_deadline(RequestCallContextSafeHandle ctx)593             public static extern Timespec grpcsharp_request_call_context_deadline(RequestCallContextSafeHandle ctx);
594 
595             [DllImport(ImportName)]
grpcsharp_request_call_context_request_metadata(RequestCallContextSafeHandle ctx)596             public static extern IntPtr grpcsharp_request_call_context_request_metadata(RequestCallContextSafeHandle ctx);
597 
598             [DllImport(ImportName)]
grpcsharp_request_call_context_reset(RequestCallContextSafeHandle ctx)599             public static extern void grpcsharp_request_call_context_reset(RequestCallContextSafeHandle ctx);
600 
601             [DllImport(ImportName)]
grpcsharp_request_call_context_destroy(IntPtr ctx)602             public static extern void grpcsharp_request_call_context_destroy(IntPtr ctx);
603 
604             [DllImport(ImportName)]
grpcsharp_composite_call_credentials_create(CallCredentialsSafeHandle creds1, CallCredentialsSafeHandle creds2)605             public static extern CallCredentialsSafeHandle grpcsharp_composite_call_credentials_create(CallCredentialsSafeHandle creds1, CallCredentialsSafeHandle creds2);
606 
607             [DllImport(ImportName)]
grpcsharp_call_credentials_release(IntPtr credentials)608             public static extern void grpcsharp_call_credentials_release(IntPtr credentials);
609 
610             [DllImport(ImportName)]
grpcsharp_call_cancel(CallSafeHandle call)611             public static extern CallError grpcsharp_call_cancel(CallSafeHandle call);
612 
613             [DllImport(ImportName)]
grpcsharp_call_cancel_with_status(CallSafeHandle call, StatusCode status, string description)614             public static extern CallError grpcsharp_call_cancel_with_status(CallSafeHandle call, StatusCode status, string description);
615 
616             [DllImport(ImportName)]
grpcsharp_call_start_unary(CallSafeHandle call, BatchContextSafeHandle ctx, byte[] sendBuffer, UIntPtr sendBufferLen, WriteFlags writeFlags, MetadataArraySafeHandle metadataArray, CallFlags metadataFlags)617             public static extern CallError grpcsharp_call_start_unary(CallSafeHandle call, BatchContextSafeHandle ctx, byte[] sendBuffer, UIntPtr sendBufferLen, WriteFlags writeFlags, MetadataArraySafeHandle metadataArray, CallFlags metadataFlags);
618 
619             [DllImport(ImportName)]
grpcsharp_call_start_client_streaming(CallSafeHandle call, BatchContextSafeHandle ctx, MetadataArraySafeHandle metadataArray, CallFlags metadataFlags)620             public static extern CallError grpcsharp_call_start_client_streaming(CallSafeHandle call, BatchContextSafeHandle ctx, MetadataArraySafeHandle metadataArray, CallFlags metadataFlags);
621 
622             [DllImport(ImportName)]
grpcsharp_call_start_server_streaming(CallSafeHandle call, BatchContextSafeHandle ctx, byte[] sendBuffer, UIntPtr sendBufferLen, WriteFlags writeFlags, MetadataArraySafeHandle metadataArray, CallFlags metadataFlags)623             public static extern CallError grpcsharp_call_start_server_streaming(CallSafeHandle call, BatchContextSafeHandle ctx, byte[] sendBuffer, UIntPtr sendBufferLen, WriteFlags writeFlags, MetadataArraySafeHandle metadataArray, CallFlags metadataFlags);
624 
625             [DllImport(ImportName)]
grpcsharp_call_start_duplex_streaming(CallSafeHandle call, BatchContextSafeHandle ctx, MetadataArraySafeHandle metadataArray, CallFlags metadataFlags)626             public static extern CallError grpcsharp_call_start_duplex_streaming(CallSafeHandle call, BatchContextSafeHandle ctx, MetadataArraySafeHandle metadataArray, CallFlags metadataFlags);
627 
628             [DllImport(ImportName)]
grpcsharp_call_send_message(CallSafeHandle call, BatchContextSafeHandle ctx, byte[] sendBuffer, UIntPtr sendBufferLen, WriteFlags writeFlags, int sendEmptyInitialMetadata)629             public static extern CallError grpcsharp_call_send_message(CallSafeHandle call, BatchContextSafeHandle ctx, byte[] sendBuffer, UIntPtr sendBufferLen, WriteFlags writeFlags, int sendEmptyInitialMetadata);
630 
631             [DllImport(ImportName)]
grpcsharp_call_send_close_from_client(CallSafeHandle call, BatchContextSafeHandle ctx)632             public static extern CallError grpcsharp_call_send_close_from_client(CallSafeHandle call, BatchContextSafeHandle ctx);
633 
634             [DllImport(ImportName)]
grpcsharp_call_send_status_from_server(CallSafeHandle call, BatchContextSafeHandle ctx, StatusCode statusCode, byte[] statusMessage, UIntPtr statusMessageLen, MetadataArraySafeHandle metadataArray, int sendEmptyInitialMetadata, byte[] optionalSendBuffer, UIntPtr optionalSendBufferLen, WriteFlags writeFlags)635             public static extern CallError grpcsharp_call_send_status_from_server(CallSafeHandle call, BatchContextSafeHandle ctx, StatusCode statusCode, byte[] statusMessage, UIntPtr statusMessageLen, MetadataArraySafeHandle metadataArray, int sendEmptyInitialMetadata, byte[] optionalSendBuffer, UIntPtr optionalSendBufferLen, WriteFlags writeFlags);
636 
637             [DllImport(ImportName)]
grpcsharp_call_recv_message(CallSafeHandle call, BatchContextSafeHandle ctx)638             public static extern CallError grpcsharp_call_recv_message(CallSafeHandle call, BatchContextSafeHandle ctx);
639 
640             [DllImport(ImportName)]
grpcsharp_call_recv_initial_metadata(CallSafeHandle call, BatchContextSafeHandle ctx)641             public static extern CallError grpcsharp_call_recv_initial_metadata(CallSafeHandle call, BatchContextSafeHandle ctx);
642 
643             [DllImport(ImportName)]
grpcsharp_call_start_serverside(CallSafeHandle call, BatchContextSafeHandle ctx)644             public static extern CallError grpcsharp_call_start_serverside(CallSafeHandle call, BatchContextSafeHandle ctx);
645 
646             [DllImport(ImportName)]
grpcsharp_call_send_initial_metadata(CallSafeHandle call, BatchContextSafeHandle ctx, MetadataArraySafeHandle metadataArray)647             public static extern CallError grpcsharp_call_send_initial_metadata(CallSafeHandle call, BatchContextSafeHandle ctx, MetadataArraySafeHandle metadataArray);
648 
649             [DllImport(ImportName)]
grpcsharp_call_set_credentials(CallSafeHandle call, CallCredentialsSafeHandle credentials)650             public static extern CallError grpcsharp_call_set_credentials(CallSafeHandle call, CallCredentialsSafeHandle credentials);
651 
652             [DllImport(ImportName)]
grpcsharp_call_get_peer(CallSafeHandle call)653             public static extern CStringSafeHandle grpcsharp_call_get_peer(CallSafeHandle call);
654 
655             [DllImport(ImportName)]
grpcsharp_call_destroy(IntPtr call)656             public static extern void grpcsharp_call_destroy(IntPtr call);
657 
658             [DllImport(ImportName)]
grpcsharp_channel_args_create(UIntPtr numArgs)659             public static extern ChannelArgsSafeHandle grpcsharp_channel_args_create(UIntPtr numArgs);
660 
661             [DllImport(ImportName)]
grpcsharp_channel_args_set_string(ChannelArgsSafeHandle args, UIntPtr index, string key, string value)662             public static extern void grpcsharp_channel_args_set_string(ChannelArgsSafeHandle args, UIntPtr index, string key, string value);
663 
664             [DllImport(ImportName)]
grpcsharp_channel_args_set_integer(ChannelArgsSafeHandle args, UIntPtr index, string key, int value)665             public static extern void grpcsharp_channel_args_set_integer(ChannelArgsSafeHandle args, UIntPtr index, string key, int value);
666 
667             [DllImport(ImportName)]
grpcsharp_channel_args_destroy(IntPtr args)668             public static extern void grpcsharp_channel_args_destroy(IntPtr args);
669 
670             [DllImport(ImportName)]
grpcsharp_override_default_ssl_roots(string pemRootCerts)671             public static extern void grpcsharp_override_default_ssl_roots(string pemRootCerts);
672 
673             [DllImport(ImportName)]
grpcsharp_ssl_credentials_create(string pemRootCerts, string keyCertPairCertChain, string keyCertPairPrivateKey)674             public static extern ChannelCredentialsSafeHandle grpcsharp_ssl_credentials_create(string pemRootCerts, string keyCertPairCertChain, string keyCertPairPrivateKey);
675 
676             [DllImport(ImportName)]
grpcsharp_composite_channel_credentials_create(ChannelCredentialsSafeHandle channelCreds, CallCredentialsSafeHandle callCreds)677             public static extern ChannelCredentialsSafeHandle grpcsharp_composite_channel_credentials_create(ChannelCredentialsSafeHandle channelCreds, CallCredentialsSafeHandle callCreds);
678 
679             [DllImport(ImportName)]
grpcsharp_channel_credentials_release(IntPtr credentials)680             public static extern void grpcsharp_channel_credentials_release(IntPtr credentials);
681 
682             [DllImport(ImportName)]
grpcsharp_insecure_channel_create(string target, ChannelArgsSafeHandle channelArgs)683             public static extern ChannelSafeHandle grpcsharp_insecure_channel_create(string target, ChannelArgsSafeHandle channelArgs);
684 
685             [DllImport(ImportName)]
grpcsharp_secure_channel_create(ChannelCredentialsSafeHandle credentials, string target, ChannelArgsSafeHandle channelArgs)686             public static extern ChannelSafeHandle grpcsharp_secure_channel_create(ChannelCredentialsSafeHandle credentials, string target, ChannelArgsSafeHandle channelArgs);
687 
688             [DllImport(ImportName)]
grpcsharp_channel_create_call(ChannelSafeHandle channel, CallSafeHandle parentCall, ContextPropagationFlags propagationMask, CompletionQueueSafeHandle cq, string method, string host, Timespec deadline)689             public static extern CallSafeHandle grpcsharp_channel_create_call(ChannelSafeHandle channel, CallSafeHandle parentCall, ContextPropagationFlags propagationMask, CompletionQueueSafeHandle cq, string method, string host, Timespec deadline);
690 
691             [DllImport(ImportName)]
grpcsharp_channel_check_connectivity_state(ChannelSafeHandle channel, int tryToConnect)692             public static extern ChannelState grpcsharp_channel_check_connectivity_state(ChannelSafeHandle channel, int tryToConnect);
693 
694             [DllImport(ImportName)]
grpcsharp_channel_watch_connectivity_state(ChannelSafeHandle channel, ChannelState lastObservedState, Timespec deadline, CompletionQueueSafeHandle cq, BatchContextSafeHandle ctx)695             public static extern void grpcsharp_channel_watch_connectivity_state(ChannelSafeHandle channel, ChannelState lastObservedState, Timespec deadline, CompletionQueueSafeHandle cq, BatchContextSafeHandle ctx);
696 
697             [DllImport(ImportName)]
grpcsharp_channel_get_target(ChannelSafeHandle call)698             public static extern CStringSafeHandle grpcsharp_channel_get_target(ChannelSafeHandle call);
699 
700             [DllImport(ImportName)]
grpcsharp_channel_destroy(IntPtr channel)701             public static extern void grpcsharp_channel_destroy(IntPtr channel);
702 
703             [DllImport(ImportName)]
grpcsharp_sizeof_grpc_event()704             public static extern int grpcsharp_sizeof_grpc_event();
705 
706             [DllImport(ImportName)]
grpcsharp_completion_queue_create_async()707             public static extern CompletionQueueSafeHandle grpcsharp_completion_queue_create_async();
708 
709             [DllImport(ImportName)]
grpcsharp_completion_queue_create_sync()710             public static extern CompletionQueueSafeHandle grpcsharp_completion_queue_create_sync();
711 
712             [DllImport(ImportName)]
grpcsharp_completion_queue_shutdown(CompletionQueueSafeHandle cq)713             public static extern void grpcsharp_completion_queue_shutdown(CompletionQueueSafeHandle cq);
714 
715             [DllImport(ImportName)]
grpcsharp_completion_queue_next(CompletionQueueSafeHandle cq)716             public static extern CompletionQueueEvent grpcsharp_completion_queue_next(CompletionQueueSafeHandle cq);
717 
718             [DllImport(ImportName)]
grpcsharp_completion_queue_pluck(CompletionQueueSafeHandle cq, IntPtr tag)719             public static extern CompletionQueueEvent grpcsharp_completion_queue_pluck(CompletionQueueSafeHandle cq, IntPtr tag);
720 
721             [DllImport(ImportName)]
grpcsharp_completion_queue_destroy(IntPtr cq)722             public static extern void grpcsharp_completion_queue_destroy(IntPtr cq);
723 
724             [DllImport(ImportName)]
gprsharp_free(IntPtr ptr)725             public static extern void gprsharp_free(IntPtr ptr);
726 
727             [DllImport(ImportName)]
grpcsharp_metadata_array_create(UIntPtr capacity)728             public static extern MetadataArraySafeHandle grpcsharp_metadata_array_create(UIntPtr capacity);
729 
730             [DllImport(ImportName)]
grpcsharp_metadata_array_add(MetadataArraySafeHandle array, string key, byte[] value, UIntPtr valueLength)731             public static extern void grpcsharp_metadata_array_add(MetadataArraySafeHandle array, string key, byte[] value, UIntPtr valueLength);
732 
733             [DllImport(ImportName)]
grpcsharp_metadata_array_count(IntPtr metadataArray)734             public static extern UIntPtr grpcsharp_metadata_array_count(IntPtr metadataArray);
735 
736             [DllImport(ImportName)]
grpcsharp_metadata_array_get_key(IntPtr metadataArray, UIntPtr index, out UIntPtr keyLength)737             public static extern IntPtr grpcsharp_metadata_array_get_key(IntPtr metadataArray, UIntPtr index, out UIntPtr keyLength);
738 
739             [DllImport(ImportName)]
grpcsharp_metadata_array_get_value(IntPtr metadataArray, UIntPtr index, out UIntPtr valueLength)740             public static extern IntPtr grpcsharp_metadata_array_get_value(IntPtr metadataArray, UIntPtr index, out UIntPtr valueLength);
741 
742             [DllImport(ImportName)]
grpcsharp_metadata_array_destroy_full(IntPtr array)743             public static extern void grpcsharp_metadata_array_destroy_full(IntPtr array);
744 
745             [DllImport(ImportName)]
grpcsharp_redirect_log(GprLogDelegate callback)746             public static extern void grpcsharp_redirect_log(GprLogDelegate callback);
747 
748             [DllImport(ImportName)]
grpcsharp_metadata_credentials_create_from_plugin(NativeMetadataInterceptor interceptor)749             public static extern CallCredentialsSafeHandle grpcsharp_metadata_credentials_create_from_plugin(NativeMetadataInterceptor interceptor);
750 
751             [DllImport(ImportName)]
grpcsharp_metadata_credentials_notify_from_plugin(IntPtr callbackPtr, IntPtr userData, MetadataArraySafeHandle metadataArray, StatusCode statusCode, string errorDetails)752             public static extern void grpcsharp_metadata_credentials_notify_from_plugin(IntPtr callbackPtr, IntPtr userData, MetadataArraySafeHandle metadataArray, StatusCode statusCode, string errorDetails);
753 
754             [DllImport(ImportName)]
grpcsharp_ssl_server_credentials_create(string pemRootCerts, string[] keyCertPairCertChainArray, string[] keyCertPairPrivateKeyArray, UIntPtr numKeyCertPairs, int forceClientAuth)755             public static extern ServerCredentialsSafeHandle grpcsharp_ssl_server_credentials_create(string pemRootCerts, string[] keyCertPairCertChainArray, string[] keyCertPairPrivateKeyArray, UIntPtr numKeyCertPairs, int forceClientAuth);
756 
757             [DllImport(ImportName)]
grpcsharp_server_credentials_release(IntPtr credentials)758             public static extern void grpcsharp_server_credentials_release(IntPtr credentials);
759 
760             [DllImport(ImportName)]
grpcsharp_server_create(ChannelArgsSafeHandle args)761             public static extern ServerSafeHandle grpcsharp_server_create(ChannelArgsSafeHandle args);
762 
763             [DllImport(ImportName)]
grpcsharp_server_register_completion_queue(ServerSafeHandle server, CompletionQueueSafeHandle cq)764             public static extern void grpcsharp_server_register_completion_queue(ServerSafeHandle server, CompletionQueueSafeHandle cq);
765 
766             [DllImport(ImportName)]
grpcsharp_server_add_insecure_http2_port(ServerSafeHandle server, string addr)767             public static extern int grpcsharp_server_add_insecure_http2_port(ServerSafeHandle server, string addr);
768 
769             [DllImport(ImportName)]
grpcsharp_server_add_secure_http2_port(ServerSafeHandle server, string addr, ServerCredentialsSafeHandle creds)770             public static extern int grpcsharp_server_add_secure_http2_port(ServerSafeHandle server, string addr, ServerCredentialsSafeHandle creds);
771 
772             [DllImport(ImportName)]
grpcsharp_server_start(ServerSafeHandle server)773             public static extern void grpcsharp_server_start(ServerSafeHandle server);
774 
775             [DllImport(ImportName)]
grpcsharp_server_request_call(ServerSafeHandle server, CompletionQueueSafeHandle cq, RequestCallContextSafeHandle ctx)776             public static extern CallError grpcsharp_server_request_call(ServerSafeHandle server, CompletionQueueSafeHandle cq, RequestCallContextSafeHandle ctx);
777 
778             [DllImport(ImportName)]
grpcsharp_server_cancel_all_calls(ServerSafeHandle server)779             public static extern void grpcsharp_server_cancel_all_calls(ServerSafeHandle server);
780 
781             [DllImport(ImportName)]
grpcsharp_server_shutdown_and_notify_callback(ServerSafeHandle server, CompletionQueueSafeHandle cq, BatchContextSafeHandle ctx)782             public static extern void grpcsharp_server_shutdown_and_notify_callback(ServerSafeHandle server, CompletionQueueSafeHandle cq, BatchContextSafeHandle ctx);
783 
784             [DllImport(ImportName)]
grpcsharp_server_destroy(IntPtr server)785             public static extern void grpcsharp_server_destroy(IntPtr server);
786 
787             [DllImport(ImportName)]
grpcsharp_call_auth_context(CallSafeHandle call)788             public static extern AuthContextSafeHandle grpcsharp_call_auth_context(CallSafeHandle call);
789 
790             [DllImport(ImportName)]
grpcsharp_auth_context_peer_identity_property_name(AuthContextSafeHandle authContext)791             public static extern IntPtr grpcsharp_auth_context_peer_identity_property_name(AuthContextSafeHandle authContext);
792 
793             [DllImport(ImportName)]
grpcsharp_auth_context_property_iterator(AuthContextSafeHandle authContext)794             public static extern AuthContextSafeHandle.NativeAuthPropertyIterator grpcsharp_auth_context_property_iterator(AuthContextSafeHandle authContext);
795 
796             [DllImport(ImportName)]
grpcsharp_auth_property_iterator_next(ref AuthContextSafeHandle.NativeAuthPropertyIterator iterator)797             public static extern IntPtr grpcsharp_auth_property_iterator_next(ref AuthContextSafeHandle.NativeAuthPropertyIterator iterator);
798 
799             [DllImport(ImportName)]
grpcsharp_auth_context_release(IntPtr authContext)800             public static extern void grpcsharp_auth_context_release(IntPtr authContext);
801 
802             [DllImport(ImportName)]
gprsharp_now(ClockType clockType)803             public static extern Timespec gprsharp_now(ClockType clockType);
804 
805             [DllImport(ImportName)]
gprsharp_inf_future(ClockType clockType)806             public static extern Timespec gprsharp_inf_future(ClockType clockType);
807 
808             [DllImport(ImportName)]
gprsharp_inf_past(ClockType clockType)809             public static extern Timespec gprsharp_inf_past(ClockType clockType);
810 
811             [DllImport(ImportName)]
gprsharp_convert_clock_type(Timespec t, ClockType targetClock)812             public static extern Timespec gprsharp_convert_clock_type(Timespec t, ClockType targetClock);
813 
814             [DllImport(ImportName)]
gprsharp_sizeof_timespec()815             public static extern int gprsharp_sizeof_timespec();
816 
817             [DllImport(ImportName)]
grpcsharp_test_callback([MarshalAs(UnmanagedType.FunctionPtr)] NativeCallbackTestDelegate callback)818             public static extern CallError grpcsharp_test_callback([MarshalAs(UnmanagedType.FunctionPtr)] NativeCallbackTestDelegate callback);
819 
820             [DllImport(ImportName)]
grpcsharp_test_nop(IntPtr ptr)821             public static extern IntPtr grpcsharp_test_nop(IntPtr ptr);
822 
823             [DllImport(ImportName)]
grpcsharp_test_override_method(string methodName, string variant)824             public static extern void grpcsharp_test_override_method(string methodName, string variant);
825         }
826 
827         /// <summary>
828         /// grpc_csharp_ext used a shared library (e.g on Unity Standalone and Android).
829         /// </summary>
830         internal class DllImportsFromSharedLib
831         {
832             private const string ImportName = "grpc_csharp_ext";
833 
834             [DllImport(ImportName)]
grpcsharp_init()835             public static extern void grpcsharp_init();
836 
837             [DllImport(ImportName)]
grpcsharp_shutdown()838             public static extern void grpcsharp_shutdown();
839 
840             [DllImport(ImportName)]
grpcsharp_version_string()841             public static extern IntPtr grpcsharp_version_string();
842 
843             [DllImport(ImportName)]
grpcsharp_batch_context_create()844             public static extern BatchContextSafeHandle grpcsharp_batch_context_create();
845 
846             [DllImport(ImportName)]
grpcsharp_batch_context_recv_initial_metadata(BatchContextSafeHandle ctx)847             public static extern IntPtr grpcsharp_batch_context_recv_initial_metadata(BatchContextSafeHandle ctx);
848 
849             [DllImport(ImportName)]
grpcsharp_batch_context_recv_message_length(BatchContextSafeHandle ctx)850             public static extern IntPtr grpcsharp_batch_context_recv_message_length(BatchContextSafeHandle ctx);
851 
852             [DllImport(ImportName)]
grpcsharp_batch_context_recv_message_to_buffer(BatchContextSafeHandle ctx, byte[] buffer, UIntPtr bufferLen)853             public static extern void grpcsharp_batch_context_recv_message_to_buffer(BatchContextSafeHandle ctx, byte[] buffer, UIntPtr bufferLen);
854 
855             [DllImport(ImportName)]
grpcsharp_batch_context_recv_status_on_client_status(BatchContextSafeHandle ctx)856             public static extern StatusCode grpcsharp_batch_context_recv_status_on_client_status(BatchContextSafeHandle ctx);
857 
858             [DllImport(ImportName)]
grpcsharp_batch_context_recv_status_on_client_details(BatchContextSafeHandle ctx, out UIntPtr detailsLength)859             public static extern IntPtr grpcsharp_batch_context_recv_status_on_client_details(BatchContextSafeHandle ctx, out UIntPtr detailsLength);
860 
861             [DllImport(ImportName)]
grpcsharp_batch_context_recv_status_on_client_trailing_metadata(BatchContextSafeHandle ctx)862             public static extern IntPtr grpcsharp_batch_context_recv_status_on_client_trailing_metadata(BatchContextSafeHandle ctx);
863 
864             [DllImport(ImportName)]
grpcsharp_batch_context_recv_close_on_server_cancelled(BatchContextSafeHandle ctx)865             public static extern int grpcsharp_batch_context_recv_close_on_server_cancelled(BatchContextSafeHandle ctx);
866 
867             [DllImport(ImportName)]
grpcsharp_batch_context_reset(BatchContextSafeHandle ctx)868             public static extern void grpcsharp_batch_context_reset(BatchContextSafeHandle ctx);
869 
870             [DllImport(ImportName)]
grpcsharp_batch_context_destroy(IntPtr ctx)871             public static extern void grpcsharp_batch_context_destroy(IntPtr ctx);
872 
873             [DllImport(ImportName)]
grpcsharp_request_call_context_create()874             public static extern RequestCallContextSafeHandle grpcsharp_request_call_context_create();
875 
876             [DllImport(ImportName)]
grpcsharp_request_call_context_call(RequestCallContextSafeHandle ctx)877             public static extern CallSafeHandle grpcsharp_request_call_context_call(RequestCallContextSafeHandle ctx);
878 
879             [DllImport(ImportName)]
grpcsharp_request_call_context_method(RequestCallContextSafeHandle ctx, out UIntPtr methodLength)880             public static extern IntPtr grpcsharp_request_call_context_method(RequestCallContextSafeHandle ctx, out UIntPtr methodLength);
881 
882             [DllImport(ImportName)]
grpcsharp_request_call_context_host(RequestCallContextSafeHandle ctx, out UIntPtr hostLength)883             public static extern IntPtr grpcsharp_request_call_context_host(RequestCallContextSafeHandle ctx, out UIntPtr hostLength);
884 
885             [DllImport(ImportName)]
grpcsharp_request_call_context_deadline(RequestCallContextSafeHandle ctx)886             public static extern Timespec grpcsharp_request_call_context_deadline(RequestCallContextSafeHandle ctx);
887 
888             [DllImport(ImportName)]
grpcsharp_request_call_context_request_metadata(RequestCallContextSafeHandle ctx)889             public static extern IntPtr grpcsharp_request_call_context_request_metadata(RequestCallContextSafeHandle ctx);
890 
891             [DllImport(ImportName)]
grpcsharp_request_call_context_reset(RequestCallContextSafeHandle ctx)892             public static extern void grpcsharp_request_call_context_reset(RequestCallContextSafeHandle ctx);
893 
894             [DllImport(ImportName)]
grpcsharp_request_call_context_destroy(IntPtr ctx)895             public static extern void grpcsharp_request_call_context_destroy(IntPtr ctx);
896 
897             [DllImport(ImportName)]
grpcsharp_composite_call_credentials_create(CallCredentialsSafeHandle creds1, CallCredentialsSafeHandle creds2)898             public static extern CallCredentialsSafeHandle grpcsharp_composite_call_credentials_create(CallCredentialsSafeHandle creds1, CallCredentialsSafeHandle creds2);
899 
900             [DllImport(ImportName)]
grpcsharp_call_credentials_release(IntPtr credentials)901             public static extern void grpcsharp_call_credentials_release(IntPtr credentials);
902 
903             [DllImport(ImportName)]
grpcsharp_call_cancel(CallSafeHandle call)904             public static extern CallError grpcsharp_call_cancel(CallSafeHandle call);
905 
906             [DllImport(ImportName)]
grpcsharp_call_cancel_with_status(CallSafeHandle call, StatusCode status, string description)907             public static extern CallError grpcsharp_call_cancel_with_status(CallSafeHandle call, StatusCode status, string description);
908 
909             [DllImport(ImportName)]
grpcsharp_call_start_unary(CallSafeHandle call, BatchContextSafeHandle ctx, byte[] sendBuffer, UIntPtr sendBufferLen, WriteFlags writeFlags, MetadataArraySafeHandle metadataArray, CallFlags metadataFlags)910             public static extern CallError grpcsharp_call_start_unary(CallSafeHandle call, BatchContextSafeHandle ctx, byte[] sendBuffer, UIntPtr sendBufferLen, WriteFlags writeFlags, MetadataArraySafeHandle metadataArray, CallFlags metadataFlags);
911 
912             [DllImport(ImportName)]
grpcsharp_call_start_client_streaming(CallSafeHandle call, BatchContextSafeHandle ctx, MetadataArraySafeHandle metadataArray, CallFlags metadataFlags)913             public static extern CallError grpcsharp_call_start_client_streaming(CallSafeHandle call, BatchContextSafeHandle ctx, MetadataArraySafeHandle metadataArray, CallFlags metadataFlags);
914 
915             [DllImport(ImportName)]
grpcsharp_call_start_server_streaming(CallSafeHandle call, BatchContextSafeHandle ctx, byte[] sendBuffer, UIntPtr sendBufferLen, WriteFlags writeFlags, MetadataArraySafeHandle metadataArray, CallFlags metadataFlags)916             public static extern CallError grpcsharp_call_start_server_streaming(CallSafeHandle call, BatchContextSafeHandle ctx, byte[] sendBuffer, UIntPtr sendBufferLen, WriteFlags writeFlags, MetadataArraySafeHandle metadataArray, CallFlags metadataFlags);
917 
918             [DllImport(ImportName)]
grpcsharp_call_start_duplex_streaming(CallSafeHandle call, BatchContextSafeHandle ctx, MetadataArraySafeHandle metadataArray, CallFlags metadataFlags)919             public static extern CallError grpcsharp_call_start_duplex_streaming(CallSafeHandle call, BatchContextSafeHandle ctx, MetadataArraySafeHandle metadataArray, CallFlags metadataFlags);
920 
921             [DllImport(ImportName)]
grpcsharp_call_send_message(CallSafeHandle call, BatchContextSafeHandle ctx, byte[] sendBuffer, UIntPtr sendBufferLen, WriteFlags writeFlags, int sendEmptyInitialMetadata)922             public static extern CallError grpcsharp_call_send_message(CallSafeHandle call, BatchContextSafeHandle ctx, byte[] sendBuffer, UIntPtr sendBufferLen, WriteFlags writeFlags, int sendEmptyInitialMetadata);
923 
924             [DllImport(ImportName)]
grpcsharp_call_send_close_from_client(CallSafeHandle call, BatchContextSafeHandle ctx)925             public static extern CallError grpcsharp_call_send_close_from_client(CallSafeHandle call, BatchContextSafeHandle ctx);
926 
927             [DllImport(ImportName)]
grpcsharp_call_send_status_from_server(CallSafeHandle call, BatchContextSafeHandle ctx, StatusCode statusCode, byte[] statusMessage, UIntPtr statusMessageLen, MetadataArraySafeHandle metadataArray, int sendEmptyInitialMetadata, byte[] optionalSendBuffer, UIntPtr optionalSendBufferLen, WriteFlags writeFlags)928             public static extern CallError grpcsharp_call_send_status_from_server(CallSafeHandle call, BatchContextSafeHandle ctx, StatusCode statusCode, byte[] statusMessage, UIntPtr statusMessageLen, MetadataArraySafeHandle metadataArray, int sendEmptyInitialMetadata, byte[] optionalSendBuffer, UIntPtr optionalSendBufferLen, WriteFlags writeFlags);
929 
930             [DllImport(ImportName)]
grpcsharp_call_recv_message(CallSafeHandle call, BatchContextSafeHandle ctx)931             public static extern CallError grpcsharp_call_recv_message(CallSafeHandle call, BatchContextSafeHandle ctx);
932 
933             [DllImport(ImportName)]
grpcsharp_call_recv_initial_metadata(CallSafeHandle call, BatchContextSafeHandle ctx)934             public static extern CallError grpcsharp_call_recv_initial_metadata(CallSafeHandle call, BatchContextSafeHandle ctx);
935 
936             [DllImport(ImportName)]
grpcsharp_call_start_serverside(CallSafeHandle call, BatchContextSafeHandle ctx)937             public static extern CallError grpcsharp_call_start_serverside(CallSafeHandle call, BatchContextSafeHandle ctx);
938 
939             [DllImport(ImportName)]
grpcsharp_call_send_initial_metadata(CallSafeHandle call, BatchContextSafeHandle ctx, MetadataArraySafeHandle metadataArray)940             public static extern CallError grpcsharp_call_send_initial_metadata(CallSafeHandle call, BatchContextSafeHandle ctx, MetadataArraySafeHandle metadataArray);
941 
942             [DllImport(ImportName)]
grpcsharp_call_set_credentials(CallSafeHandle call, CallCredentialsSafeHandle credentials)943             public static extern CallError grpcsharp_call_set_credentials(CallSafeHandle call, CallCredentialsSafeHandle credentials);
944 
945             [DllImport(ImportName)]
grpcsharp_call_get_peer(CallSafeHandle call)946             public static extern CStringSafeHandle grpcsharp_call_get_peer(CallSafeHandle call);
947 
948             [DllImport(ImportName)]
grpcsharp_call_destroy(IntPtr call)949             public static extern void grpcsharp_call_destroy(IntPtr call);
950 
951             [DllImport(ImportName)]
grpcsharp_channel_args_create(UIntPtr numArgs)952             public static extern ChannelArgsSafeHandle grpcsharp_channel_args_create(UIntPtr numArgs);
953 
954             [DllImport(ImportName)]
grpcsharp_channel_args_set_string(ChannelArgsSafeHandle args, UIntPtr index, string key, string value)955             public static extern void grpcsharp_channel_args_set_string(ChannelArgsSafeHandle args, UIntPtr index, string key, string value);
956 
957             [DllImport(ImportName)]
grpcsharp_channel_args_set_integer(ChannelArgsSafeHandle args, UIntPtr index, string key, int value)958             public static extern void grpcsharp_channel_args_set_integer(ChannelArgsSafeHandle args, UIntPtr index, string key, int value);
959 
960             [DllImport(ImportName)]
grpcsharp_channel_args_destroy(IntPtr args)961             public static extern void grpcsharp_channel_args_destroy(IntPtr args);
962 
963             [DllImport(ImportName)]
grpcsharp_override_default_ssl_roots(string pemRootCerts)964             public static extern void grpcsharp_override_default_ssl_roots(string pemRootCerts);
965 
966             [DllImport(ImportName)]
grpcsharp_ssl_credentials_create(string pemRootCerts, string keyCertPairCertChain, string keyCertPairPrivateKey)967             public static extern ChannelCredentialsSafeHandle grpcsharp_ssl_credentials_create(string pemRootCerts, string keyCertPairCertChain, string keyCertPairPrivateKey);
968 
969             [DllImport(ImportName)]
grpcsharp_composite_channel_credentials_create(ChannelCredentialsSafeHandle channelCreds, CallCredentialsSafeHandle callCreds)970             public static extern ChannelCredentialsSafeHandle grpcsharp_composite_channel_credentials_create(ChannelCredentialsSafeHandle channelCreds, CallCredentialsSafeHandle callCreds);
971 
972             [DllImport(ImportName)]
grpcsharp_channel_credentials_release(IntPtr credentials)973             public static extern void grpcsharp_channel_credentials_release(IntPtr credentials);
974 
975             [DllImport(ImportName)]
grpcsharp_insecure_channel_create(string target, ChannelArgsSafeHandle channelArgs)976             public static extern ChannelSafeHandle grpcsharp_insecure_channel_create(string target, ChannelArgsSafeHandle channelArgs);
977 
978             [DllImport(ImportName)]
grpcsharp_secure_channel_create(ChannelCredentialsSafeHandle credentials, string target, ChannelArgsSafeHandle channelArgs)979             public static extern ChannelSafeHandle grpcsharp_secure_channel_create(ChannelCredentialsSafeHandle credentials, string target, ChannelArgsSafeHandle channelArgs);
980 
981             [DllImport(ImportName)]
grpcsharp_channel_create_call(ChannelSafeHandle channel, CallSafeHandle parentCall, ContextPropagationFlags propagationMask, CompletionQueueSafeHandle cq, string method, string host, Timespec deadline)982             public static extern CallSafeHandle grpcsharp_channel_create_call(ChannelSafeHandle channel, CallSafeHandle parentCall, ContextPropagationFlags propagationMask, CompletionQueueSafeHandle cq, string method, string host, Timespec deadline);
983 
984             [DllImport(ImportName)]
grpcsharp_channel_check_connectivity_state(ChannelSafeHandle channel, int tryToConnect)985             public static extern ChannelState grpcsharp_channel_check_connectivity_state(ChannelSafeHandle channel, int tryToConnect);
986 
987             [DllImport(ImportName)]
grpcsharp_channel_watch_connectivity_state(ChannelSafeHandle channel, ChannelState lastObservedState, Timespec deadline, CompletionQueueSafeHandle cq, BatchContextSafeHandle ctx)988             public static extern void grpcsharp_channel_watch_connectivity_state(ChannelSafeHandle channel, ChannelState lastObservedState, Timespec deadline, CompletionQueueSafeHandle cq, BatchContextSafeHandle ctx);
989 
990             [DllImport(ImportName)]
grpcsharp_channel_get_target(ChannelSafeHandle call)991             public static extern CStringSafeHandle grpcsharp_channel_get_target(ChannelSafeHandle call);
992 
993             [DllImport(ImportName)]
grpcsharp_channel_destroy(IntPtr channel)994             public static extern void grpcsharp_channel_destroy(IntPtr channel);
995 
996             [DllImport(ImportName)]
grpcsharp_sizeof_grpc_event()997             public static extern int grpcsharp_sizeof_grpc_event();
998 
999             [DllImport(ImportName)]
grpcsharp_completion_queue_create_async()1000             public static extern CompletionQueueSafeHandle grpcsharp_completion_queue_create_async();
1001 
1002             [DllImport(ImportName)]
grpcsharp_completion_queue_create_sync()1003             public static extern CompletionQueueSafeHandle grpcsharp_completion_queue_create_sync();
1004 
1005             [DllImport(ImportName)]
grpcsharp_completion_queue_shutdown(CompletionQueueSafeHandle cq)1006             public static extern void grpcsharp_completion_queue_shutdown(CompletionQueueSafeHandle cq);
1007 
1008             [DllImport(ImportName)]
grpcsharp_completion_queue_next(CompletionQueueSafeHandle cq)1009             public static extern CompletionQueueEvent grpcsharp_completion_queue_next(CompletionQueueSafeHandle cq);
1010 
1011             [DllImport(ImportName)]
grpcsharp_completion_queue_pluck(CompletionQueueSafeHandle cq, IntPtr tag)1012             public static extern CompletionQueueEvent grpcsharp_completion_queue_pluck(CompletionQueueSafeHandle cq, IntPtr tag);
1013 
1014             [DllImport(ImportName)]
grpcsharp_completion_queue_destroy(IntPtr cq)1015             public static extern void grpcsharp_completion_queue_destroy(IntPtr cq);
1016 
1017             [DllImport(ImportName)]
gprsharp_free(IntPtr ptr)1018             public static extern void gprsharp_free(IntPtr ptr);
1019 
1020             [DllImport(ImportName)]
grpcsharp_metadata_array_create(UIntPtr capacity)1021             public static extern MetadataArraySafeHandle grpcsharp_metadata_array_create(UIntPtr capacity);
1022 
1023             [DllImport(ImportName)]
grpcsharp_metadata_array_add(MetadataArraySafeHandle array, string key, byte[] value, UIntPtr valueLength)1024             public static extern void grpcsharp_metadata_array_add(MetadataArraySafeHandle array, string key, byte[] value, UIntPtr valueLength);
1025 
1026             [DllImport(ImportName)]
grpcsharp_metadata_array_count(IntPtr metadataArray)1027             public static extern UIntPtr grpcsharp_metadata_array_count(IntPtr metadataArray);
1028 
1029             [DllImport(ImportName)]
grpcsharp_metadata_array_get_key(IntPtr metadataArray, UIntPtr index, out UIntPtr keyLength)1030             public static extern IntPtr grpcsharp_metadata_array_get_key(IntPtr metadataArray, UIntPtr index, out UIntPtr keyLength);
1031 
1032             [DllImport(ImportName)]
grpcsharp_metadata_array_get_value(IntPtr metadataArray, UIntPtr index, out UIntPtr valueLength)1033             public static extern IntPtr grpcsharp_metadata_array_get_value(IntPtr metadataArray, UIntPtr index, out UIntPtr valueLength);
1034 
1035             [DllImport(ImportName)]
grpcsharp_metadata_array_destroy_full(IntPtr array)1036             public static extern void grpcsharp_metadata_array_destroy_full(IntPtr array);
1037 
1038             [DllImport(ImportName)]
grpcsharp_redirect_log(GprLogDelegate callback)1039             public static extern void grpcsharp_redirect_log(GprLogDelegate callback);
1040 
1041             [DllImport(ImportName)]
grpcsharp_metadata_credentials_create_from_plugin(NativeMetadataInterceptor interceptor)1042             public static extern CallCredentialsSafeHandle grpcsharp_metadata_credentials_create_from_plugin(NativeMetadataInterceptor interceptor);
1043 
1044             [DllImport(ImportName)]
grpcsharp_metadata_credentials_notify_from_plugin(IntPtr callbackPtr, IntPtr userData, MetadataArraySafeHandle metadataArray, StatusCode statusCode, string errorDetails)1045             public static extern void grpcsharp_metadata_credentials_notify_from_plugin(IntPtr callbackPtr, IntPtr userData, MetadataArraySafeHandle metadataArray, StatusCode statusCode, string errorDetails);
1046 
1047             [DllImport(ImportName)]
grpcsharp_ssl_server_credentials_create(string pemRootCerts, string[] keyCertPairCertChainArray, string[] keyCertPairPrivateKeyArray, UIntPtr numKeyCertPairs, int forceClientAuth)1048             public static extern ServerCredentialsSafeHandle grpcsharp_ssl_server_credentials_create(string pemRootCerts, string[] keyCertPairCertChainArray, string[] keyCertPairPrivateKeyArray, UIntPtr numKeyCertPairs, int forceClientAuth);
1049 
1050             [DllImport(ImportName)]
grpcsharp_server_credentials_release(IntPtr credentials)1051             public static extern void grpcsharp_server_credentials_release(IntPtr credentials);
1052 
1053             [DllImport(ImportName)]
grpcsharp_server_create(ChannelArgsSafeHandle args)1054             public static extern ServerSafeHandle grpcsharp_server_create(ChannelArgsSafeHandle args);
1055 
1056             [DllImport(ImportName)]
grpcsharp_server_register_completion_queue(ServerSafeHandle server, CompletionQueueSafeHandle cq)1057             public static extern void grpcsharp_server_register_completion_queue(ServerSafeHandle server, CompletionQueueSafeHandle cq);
1058 
1059             [DllImport(ImportName)]
grpcsharp_server_add_insecure_http2_port(ServerSafeHandle server, string addr)1060             public static extern int grpcsharp_server_add_insecure_http2_port(ServerSafeHandle server, string addr);
1061 
1062             [DllImport(ImportName)]
grpcsharp_server_add_secure_http2_port(ServerSafeHandle server, string addr, ServerCredentialsSafeHandle creds)1063             public static extern int grpcsharp_server_add_secure_http2_port(ServerSafeHandle server, string addr, ServerCredentialsSafeHandle creds);
1064 
1065             [DllImport(ImportName)]
grpcsharp_server_start(ServerSafeHandle server)1066             public static extern void grpcsharp_server_start(ServerSafeHandle server);
1067 
1068             [DllImport(ImportName)]
grpcsharp_server_request_call(ServerSafeHandle server, CompletionQueueSafeHandle cq, RequestCallContextSafeHandle ctx)1069             public static extern CallError grpcsharp_server_request_call(ServerSafeHandle server, CompletionQueueSafeHandle cq, RequestCallContextSafeHandle ctx);
1070 
1071             [DllImport(ImportName)]
grpcsharp_server_cancel_all_calls(ServerSafeHandle server)1072             public static extern void grpcsharp_server_cancel_all_calls(ServerSafeHandle server);
1073 
1074             [DllImport(ImportName)]
grpcsharp_server_shutdown_and_notify_callback(ServerSafeHandle server, CompletionQueueSafeHandle cq, BatchContextSafeHandle ctx)1075             public static extern void grpcsharp_server_shutdown_and_notify_callback(ServerSafeHandle server, CompletionQueueSafeHandle cq, BatchContextSafeHandle ctx);
1076 
1077             [DllImport(ImportName)]
grpcsharp_server_destroy(IntPtr server)1078             public static extern void grpcsharp_server_destroy(IntPtr server);
1079 
1080             [DllImport(ImportName)]
grpcsharp_call_auth_context(CallSafeHandle call)1081             public static extern AuthContextSafeHandle grpcsharp_call_auth_context(CallSafeHandle call);
1082 
1083             [DllImport(ImportName)]
grpcsharp_auth_context_peer_identity_property_name(AuthContextSafeHandle authContext)1084             public static extern IntPtr grpcsharp_auth_context_peer_identity_property_name(AuthContextSafeHandle authContext);
1085 
1086             [DllImport(ImportName)]
grpcsharp_auth_context_property_iterator(AuthContextSafeHandle authContext)1087             public static extern AuthContextSafeHandle.NativeAuthPropertyIterator grpcsharp_auth_context_property_iterator(AuthContextSafeHandle authContext);
1088 
1089             [DllImport(ImportName)]
grpcsharp_auth_property_iterator_next(ref AuthContextSafeHandle.NativeAuthPropertyIterator iterator)1090             public static extern IntPtr grpcsharp_auth_property_iterator_next(ref AuthContextSafeHandle.NativeAuthPropertyIterator iterator);
1091 
1092             [DllImport(ImportName)]
grpcsharp_auth_context_release(IntPtr authContext)1093             public static extern void grpcsharp_auth_context_release(IntPtr authContext);
1094 
1095             [DllImport(ImportName)]
gprsharp_now(ClockType clockType)1096             public static extern Timespec gprsharp_now(ClockType clockType);
1097 
1098             [DllImport(ImportName)]
gprsharp_inf_future(ClockType clockType)1099             public static extern Timespec gprsharp_inf_future(ClockType clockType);
1100 
1101             [DllImport(ImportName)]
gprsharp_inf_past(ClockType clockType)1102             public static extern Timespec gprsharp_inf_past(ClockType clockType);
1103 
1104             [DllImport(ImportName)]
gprsharp_convert_clock_type(Timespec t, ClockType targetClock)1105             public static extern Timespec gprsharp_convert_clock_type(Timespec t, ClockType targetClock);
1106 
1107             [DllImport(ImportName)]
gprsharp_sizeof_timespec()1108             public static extern int gprsharp_sizeof_timespec();
1109 
1110             [DllImport(ImportName)]
grpcsharp_test_callback([MarshalAs(UnmanagedType.FunctionPtr)] NativeCallbackTestDelegate callback)1111             public static extern CallError grpcsharp_test_callback([MarshalAs(UnmanagedType.FunctionPtr)] NativeCallbackTestDelegate callback);
1112 
1113             [DllImport(ImportName)]
grpcsharp_test_nop(IntPtr ptr)1114             public static extern IntPtr grpcsharp_test_nop(IntPtr ptr);
1115 
1116             [DllImport(ImportName)]
grpcsharp_test_override_method(string methodName, string variant)1117             public static extern void grpcsharp_test_override_method(string methodName, string variant);
1118         }
1119     }
1120 }
1121