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 /* Gets the wrapped call from a VALUE. */
27 grpc_call* grpc_rb_get_wrapped_call(VALUE v);
28 
29 /* Gets the VALUE corresponding to given grpc_call. */
30 VALUE grpc_rb_wrap_call(grpc_call* c, grpc_completion_queue* q);
31 
32 /* Provides the details of an call error */
33 const char* grpc_call_error_detail_of(grpc_call_error err);
34 
35 /* Converts a metadata array to a hash. */
36 VALUE grpc_rb_md_ary_to_h(grpc_metadata_array* md_ary);
37 
38 /* grpc_rb_md_ary_convert converts a ruby metadata hash into
39    a grpc_metadata_array.
40 */
41 void grpc_rb_md_ary_convert(VALUE md_ary_hash, grpc_metadata_array* md_ary);
42 
43 void grpc_rb_metadata_array_destroy_including_entries(
44     grpc_metadata_array* md_ary);
45 
46 /* grpc_rb_eCallError is the ruby class of the exception thrown during call
47    operations. */
48 extern VALUE grpc_rb_eCallError;
49 
50 /* Initializes the Call class. */
51 void Init_grpc_call();
52 
53 #endif /* GRPC_RB_CALL_H_ */
54