NativeMethods.Generated.cs 99 KB

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