OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef REMOTING_PROTOCOL_CHANNEL_MULTIPLEXER_H_ | 5 #ifndef REMOTING_PROTOCOL_CHANNEL_MULTIPLEXER_H_ |
6 #define REMOTING_PROTOCOL_CHANNEL_MULTIPLEXER_H_ | 6 #define REMOTING_PROTOCOL_CHANNEL_MULTIPLEXER_H_ |
7 | 7 |
8 #include "base/memory/weak_ptr.h" | 8 #include "base/memory/weak_ptr.h" |
9 #include "remoting/proto/mux.pb.h" | 9 #include "remoting/proto/mux.pb.h" |
10 #include "remoting/protocol/buffered_socket_writer.h" | 10 #include "remoting/protocol/buffered_socket_writer.h" |
11 #include "remoting/protocol/channel_factory.h" | 11 #include "remoting/protocol/channel_factory.h" |
12 #include "remoting/protocol/message_reader.h" | 12 #include "remoting/protocol/message_reader.h" |
13 | 13 |
14 namespace remoting { | 14 namespace remoting { |
15 namespace protocol { | 15 namespace protocol { |
16 | 16 |
17 class ChannelMultiplexer : public ChannelFactory { | 17 class ChannelMultiplexer : public ChannelFactory { |
18 public: | 18 public: |
19 static const char kMuxChannelName[]; | 19 static const char kMuxChannelName[]; |
20 | 20 |
21 // |factory| is used to create the channel upon which to multiplex. | 21 // |factory| is used to create the channel upon which to multiplex. |
22 ChannelMultiplexer(ChannelFactory* factory, | 22 ChannelMultiplexer(ChannelFactory* factory, |
23 const std::string& base_channel_name); | 23 const std::string& base_channel_name); |
24 virtual ~ChannelMultiplexer(); | 24 virtual ~ChannelMultiplexer(); |
25 | 25 |
26 // ChannelFactory interface. | 26 // ChannelFactory interface. |
27 virtual void CreateStreamChannel( | 27 virtual void CreateChannel(const std::string& name, |
28 const std::string& name, | 28 const ChannelCreatedCallback& callback) OVERRIDE; |
29 const StreamChannelCallback& callback) OVERRIDE; | |
30 virtual void CreateDatagramChannel( | |
31 const std::string& name, | |
32 const DatagramChannelCallback& callback) OVERRIDE; | |
33 virtual void CancelChannelCreation(const std::string& name) OVERRIDE; | 29 virtual void CancelChannelCreation(const std::string& name) OVERRIDE; |
34 | 30 |
35 private: | 31 private: |
36 struct PendingChannel; | 32 struct PendingChannel; |
37 class MuxChannel; | 33 class MuxChannel; |
38 class MuxSocket; | 34 class MuxSocket; |
39 friend class MuxChannel; | 35 friend class MuxChannel; |
40 | 36 |
41 // Callback for |base_channel_| creation. | 37 // Callback for |base_channel_| creation. |
42 void OnBaseChannelReady(scoped_ptr<net::StreamSocket> socket); | 38 void OnBaseChannelReady(scoped_ptr<net::StreamSocket> socket); |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 base::WeakPtrFactory<ChannelMultiplexer> weak_factory_; | 83 base::WeakPtrFactory<ChannelMultiplexer> weak_factory_; |
88 | 84 |
89 DISALLOW_COPY_AND_ASSIGN(ChannelMultiplexer); | 85 DISALLOW_COPY_AND_ASSIGN(ChannelMultiplexer); |
90 }; | 86 }; |
91 | 87 |
92 } // namespace protocol | 88 } // namespace protocol |
93 } // namespace remoting | 89 } // namespace remoting |
94 | 90 |
95 | 91 |
96 #endif // REMOTING_PROTOCOL_CHANNEL_MULTIPLEXER_H_ | 92 #endif // REMOTING_PROTOCOL_CHANNEL_MULTIPLEXER_H_ |
OLD | NEW |