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