1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 |
|
19 | #ifndef NET_GRPC_NODE_CHANNEL_H_
|
20 | #define NET_GRPC_NODE_CHANNEL_H_
|
21 |
|
22 | #include <nan.h>
|
23 | #include <node.h>
|
24 | #include "grpc/grpc.h"
|
25 |
|
26 | namespace grpc {
|
27 | namespace node {
|
28 |
|
29 | bool ParseChannelArgs(v8::Local<v8::Value> args_val,
|
30 | grpc_channel_args **channel_args_ptr);
|
31 |
|
32 | void DeallocateChannelArgs(grpc_channel_args *channel_args);
|
33 |
|
34 |
|
35 | class Channel : public Nan::ObjectWrap {
|
36 | public:
|
37 | static void Init(v8::Local<v8::Object> exports);
|
38 | static bool HasInstance(v8::Local<v8::Value> val);
|
39 | |
40 |
|
41 | static v8::Persistent<v8::Value> prototype;
|
42 |
|
43 |
|
44 | grpc_channel *GetWrappedChannel();
|
45 |
|
46 | private:
|
47 | explicit Channel(grpc_channel *channel);
|
48 | ~Channel();
|
49 |
|
50 |
|
51 | Channel(const Channel &);
|
52 | Channel &operator=(const Channel &);
|
53 |
|
54 | static NAN_METHOD(New);
|
55 | static NAN_METHOD(Close);
|
56 | static NAN_METHOD(GetTarget);
|
57 | static NAN_METHOD(GetConnectivityState);
|
58 | static NAN_METHOD(WatchConnectivityState);
|
59 | static NAN_METHOD(CreateCall);
|
60 | static Nan::Callback *constructor;
|
61 | static Nan::Persistent<v8::FunctionTemplate> fun_tpl;
|
62 |
|
63 | grpc_channel *wrapped_channel;
|
64 | };
|
65 |
|
66 | }
|
67 | }
|
68 |
|
69 | #endif
|