gRPC  0.6.0
 All Classes Namespaces Functions Variables Enumerations Properties Pages
rb_grpc.h
1 /*
2  *
3  * Copyright 2015, Google Inc.
4  * All rights reserved.
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions are
8  * met:
9  *
10  * * Redistributions of source code must retain the above copyright
11  * notice, this list of conditions and the following disclaimer.
12  * * Redistributions in binary form must reproduce the above
13  * copyright notice, this list of conditions and the following disclaimer
14  * in the documentation and/or other materials provided with the
15  * distribution.
16  * * Neither the name of Google Inc. nor the names of its
17  * contributors may be used to endorse or promote products derived from
18  * this software without specific prior written permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  *
32  */
33 
34 #ifndef GRPC_RB_H_
35 #define GRPC_RB_H_
36 
37 #include <sys/time.h>
38 #include <ruby.h>
39 #include <grpc/support/time.h>
40 
41 /* grpc_rb_mGrpcCore is the module containing the ruby wrapper GRPC classes. */
42 extern VALUE grpc_rb_mGrpcCore;
43 
44 /* grpc_rb_sNewServerRpc is the struct that holds new server rpc details. */
45 extern VALUE grpc_rb_sNewServerRpc;
46 
47 /* grpc_rb_sStruct is the struct that holds status details. */
48 extern VALUE grpc_rb_sStatus;
49 
50 /* sym_code is the symbol for the code attribute of grpc_rb_sStatus. */
51 extern VALUE sym_code;
52 
53 /* sym_details is the symbol for the details attribute of grpc_rb_sStatus. */
54 extern VALUE sym_details;
55 
56 /* sym_metadata is the symbol for the metadata attribute of grpc_rb_sStatus. */
57 extern VALUE sym_metadata;
58 
59 /* GC_NOT_MARKED is used in calls to Data_Wrap_Struct to indicate that the
60  wrapped struct does not need to participate in ruby gc. */
61 #define GRPC_RB_GC_NOT_MARKED (RUBY_DATA_FUNC)(NULL)
62 
63 /* GC_DONT_FREED is used in calls to Data_Wrap_Struct to indicate that the
64  wrapped struct should not be freed the wrapped ruby object is released by
65  the garbage collector. */
66 #define GRPC_RB_GC_DONT_FREE (RUBY_DATA_FUNC)(NULL)
67 
68 /* GRPC_RB_MEMSIZE_UNAVAILABLE is used in rb_data_type_t to indicate that the
69  * number of bytes used by the wrapped struct is not available. */
70 #define GRPC_RB_MEMSIZE_UNAVAILABLE (size_t (*)(const void*))(NULL)
71 
72 /* A ruby object alloc func that fails by raising an exception. */
73 VALUE grpc_rb_cannot_alloc(VALUE cls);
74 
75 /* A ruby object init func that fails by raising an exception. */
76 VALUE grpc_rb_cannot_init(VALUE self);
77 
78 /* A ruby object clone init func that fails by raising an exception. */
79 VALUE grpc_rb_cannot_init_copy(VALUE copy, VALUE self);
80 
81 /* grpc_rb_time_timeval creates a gpr_timespec from a ruby time object. */
82 gpr_timespec grpc_rb_time_timeval(VALUE time, int interval);
83 
84 #endif /* GRPC_RB_H_ */
Definition: time.h:48