Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(15)

Side by Side Diff: remoting/protocol/channel_dispatcher_base.h

Issue 1197853003: Add P2PDatagramSocket and P2PStreamSocket interfaces. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « remoting/protocol/channel_authenticator.h ('k') | remoting/protocol/channel_dispatcher_base.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_DISPATCHER_BASE_H_ 5 #ifndef REMOTING_PROTOCOL_CHANNEL_DISPATCHER_BASE_H_
6 #define REMOTING_PROTOCOL_CHANNEL_DISPATCHER_BASE_H_ 6 #define REMOTING_PROTOCOL_CHANNEL_DISPATCHER_BASE_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 #include "base/callback.h" 11 #include "base/callback.h"
12 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
13 #include "remoting/base/buffered_socket_writer.h" 13 #include "remoting/base/buffered_socket_writer.h"
14 #include "remoting/protocol/errors.h" 14 #include "remoting/protocol/errors.h"
15 #include "remoting/protocol/message_reader.h" 15 #include "remoting/protocol/message_reader.h"
16 16
17 namespace net {
18 class StreamSocket;
19 } // namespace net
20
21 namespace remoting { 17 namespace remoting {
22 namespace protocol { 18 namespace protocol {
23 19
24 struct ChannelConfig; 20 struct ChannelConfig;
25 class StreamChannelFactory; 21 class StreamChannelFactory;
26 class Session; 22 class Session;
27 23
28 // Base class for channel message dispatchers. It's responsible for 24 // Base class for channel message dispatchers. It's responsible for
29 // creating the named channel. Derived dispatchers then dispatch 25 // creating the named channel. Derived dispatchers then dispatch
30 // incoming messages on this channel as well as send outgoing 26 // incoming messages on this channel as well as send outgoing
(...skipping 28 matching lines...) Expand all
59 // Returns true if the channel is currently connected. 55 // Returns true if the channel is currently connected.
60 bool is_connected() { return channel_ != nullptr; } 56 bool is_connected() { return channel_ != nullptr; }
61 57
62 protected: 58 protected:
63 explicit ChannelDispatcherBase(const char* channel_name); 59 explicit ChannelDispatcherBase(const char* channel_name);
64 60
65 BufferedSocketWriter* writer() { return &writer_; } 61 BufferedSocketWriter* writer() { return &writer_; }
66 MessageReader* reader() { return &reader_; } 62 MessageReader* reader() { return &reader_; }
67 63
68 private: 64 private:
69 void OnChannelReady(scoped_ptr<net::StreamSocket> socket); 65 void OnChannelReady(scoped_ptr<P2PStreamSocket> socket);
70 void OnReadWriteFailed(int error); 66 void OnReadWriteFailed(int error);
71 67
72 std::string channel_name_; 68 std::string channel_name_;
73 StreamChannelFactory* channel_factory_; 69 StreamChannelFactory* channel_factory_;
74 EventHandler* event_handler_; 70 EventHandler* event_handler_;
75 scoped_ptr<net::StreamSocket> channel_; 71 scoped_ptr<P2PStreamSocket> channel_;
76 72
77 BufferedSocketWriter writer_; 73 BufferedSocketWriter writer_;
78 MessageReader reader_; 74 MessageReader reader_;
79 75
80 DISALLOW_COPY_AND_ASSIGN(ChannelDispatcherBase); 76 DISALLOW_COPY_AND_ASSIGN(ChannelDispatcherBase);
81 }; 77 };
82 78
83 } // namespace protocol 79 } // namespace protocol
84 } // namespace remoting 80 } // namespace remoting
85 81
86 #endif // REMOTING_PROTOCOL_CHANNEL_DISPATCHER_BASE_H_ 82 #endif // REMOTING_PROTOCOL_CHANNEL_DISPATCHER_BASE_H_
OLDNEW
« no previous file with comments | « remoting/protocol/channel_authenticator.h ('k') | remoting/protocol/channel_dispatcher_base.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698