1 /* 2 * 3 * Copyright 2015 gRPC authors. 4 * 5 * Licensed under the Apache License, Version 2.0 (the "License"); 6 * you may not use this file except in compliance with the License. 7 * You may obtain a copy of the License at 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 * See the License for the specific language governing permissions and 15 * limitations under the License. 16 * 17 */ 18 19 #ifndef GRPC_RB_CALL_H_ 20 #define GRPC_RB_CALL_H_ 21 22 #include <ruby/ruby.h> 23 24 #include <grpc/grpc.h> 25 26 extern const rb_data_type_t grpc_rb_md_ary_data_type; 27 28 extern VALUE grpc_rb_cMdAry; 29 30 /* Gets the wrapped call from a VALUE. */ 31 grpc_call* grpc_rb_get_wrapped_call(VALUE v); 32 33 /* Gets the VALUE corresponding to given grpc_call. */ 34 VALUE grpc_rb_wrap_call(grpc_call* c, grpc_completion_queue* q); 35 36 /* Provides the details of an call error */ 37 const char* grpc_call_error_detail_of(grpc_call_error err); 38 39 /* Converts a metadata array to a hash. */ 40 VALUE grpc_rb_md_ary_to_h(grpc_metadata_array* md_ary); 41 42 /* grpc_rb_md_ary_convert converts a ruby metadata hash into 43 a grpc_metadata_array. 44 */ 45 void grpc_rb_md_ary_convert(VALUE md_ary_hash, grpc_metadata_array* md_ary); 46 47 void grpc_rb_metadata_array_destroy_including_entries( 48 grpc_metadata_array* md_ary); 49 50 /* grpc_rb_eCallError is the ruby class of the exception thrown during call 51 operations. */ 52 extern VALUE grpc_rb_eCallError; 53 54 /* Initializes the Call class. */ 55 void Init_grpc_call(); 56 57 #endif /* GRPC_RB_CALL_H_ */ 58