blob: cd239247c8270c9518f39d27a068515c5dd31353 [file] [log] [blame]
Nicolas Nobleb7ebd3b2014-11-26 16:33:03 -08001/*
2 *
Craig Tiller06059952015-02-18 08:34:56 -08003 * Copyright 2015, Google Inc.
Nicolas Nobleb7ebd3b2014-11-26 16:33:03 -08004 * 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
Nicolas "Pixel" Noble1ff52d52015-03-01 05:24:36 +010034#ifndef GRPC_INTERNAL_CPP_CLIENT_CHANNEL_H
35#define GRPC_INTERNAL_CPP_CLIENT_CHANNEL_H
Nicolas Nobleb7ebd3b2014-11-26 16:33:03 -080036
yangg59dfc902014-12-19 14:00:14 -080037#include <memory>
38
Nicolas Nobleb7ebd3b2014-11-26 16:33:03 -080039#include <grpc++/channel_interface.h>
40#include <grpc++/config.h>
Yang Gaoc4b6ffb2015-04-23 16:35:24 -070041#include <grpc++/impl/grpc_library.h>
Nicolas Nobleb7ebd3b2014-11-26 16:33:03 -080042
43struct grpc_channel;
44
45namespace grpc {
Craig Tiller50950712015-02-09 10:38:38 -080046class Call;
47class CallOpBuffer;
yangg59dfc902014-12-19 14:00:14 -080048class ChannelArguments;
Craig Tillerc4965752015-02-09 09:51:00 -080049class CompletionQueue;
yangg59dfc902014-12-19 14:00:14 -080050class Credentials;
Nicolas Nobleb7ebd3b2014-11-26 16:33:03 -080051class StreamContextInterface;
52
Yang Gaoc4b6ffb2015-04-23 16:35:24 -070053class Channel GRPC_FINAL : public GrpcLibrary,
54 public ChannelInterface {
Nicolas Nobleb7ebd3b2014-11-26 16:33:03 -080055 public:
Yang Gao6baa9b62015-03-17 10:49:39 -070056 Channel(const grpc::string& target, grpc_channel* c_channel);
Craig Tillercf133f42015-02-26 14:05:56 -080057 ~Channel() GRPC_OVERRIDE;
Nicolas Nobleb7ebd3b2014-11-26 16:33:03 -080058
Craig Tiller62d28962015-04-10 17:11:51 -070059 virtual void *RegisterMethod(const char *method) GRPC_OVERRIDE;
Yang Gao6baa9b62015-03-17 10:49:39 -070060 virtual Call CreateCall(const RpcMethod& method, ClientContext* context,
61 CompletionQueue* cq) GRPC_OVERRIDE;
62 virtual void PerformOpsOnCall(CallOpBuffer* ops, Call* call) GRPC_OVERRIDE;
Nicolas Nobleb7ebd3b2014-11-26 16:33:03 -080063
Nicolas Nobleb7ebd3b2014-11-26 16:33:03 -080064 private:
65 const grpc::string target_;
Yang Gao6baa9b62015-03-17 10:49:39 -070066 grpc_channel* const c_channel_; // owned
Nicolas Nobleb7ebd3b2014-11-26 16:33:03 -080067};
68
69} // namespace grpc
70
Nicolas "Pixel" Noble1ff52d52015-03-01 05:24:36 +010071#endif // GRPC_INTERNAL_CPP_CLIENT_CHANNEL_H