OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef REMOTING_PROTOCOL_DATAGRAM_CHANNEL_FACTORY_H_ | |
6 #define REMOTING_PROTOCOL_DATAGRAM_CHANNEL_FACTORY_H_ | |
7 | |
8 namespace net { | |
9 class Socket; | |
10 } // namespace net | |
11 | |
12 namespace remoting { | |
13 namespace protocol { | |
14 | |
15 class DatagramChannelFactory { | |
16 public: | |
17 typedef base::Callback<void(scoped_ptr<net::Socket>)> | |
18 ChannelCreatedCallback; | |
19 | |
20 DatagramChannelFactory() {} | |
21 | |
22 // Creates new channels and calls the |callback| when then new channel is | |
23 // created and connected. The |callback| is called with NULL if connection | |
24 // failed for any reason. Callback may be called synchronously, before the | |
Wez
2014/09/10 02:29:26
nit: There is no "connection" for a datagram chann
Sergey Ulanov
2014/09/10 21:50:58
There might be in some cases. E.g. for secure DTLS
Wez
2014/09/10 22:19:41
True; maybe refer to it as "channel setup" rather
Sergey Ulanov
2014/09/10 22:49:30
Done.
| |
25 // call returns. All channels must be destroyed before the factory is | |
26 // destroyed and CancelChannelCreation() must be called to cancel creation of | |
27 // channels for which the |callback| hasn't been called yet. | |
Wez
2014/09/10 02:29:26
See comments on ChannelFactory
Sergey Ulanov
2014/09/10 21:50:58
Done.
| |
28 virtual void CreateChannel(const std::string& name, | |
29 const ChannelCreatedCallback& callback) = 0; | |
30 | |
31 // Cancels a pending CreateChannel() operation for the named channel. If the | |
32 // channel creation already completed then canceling it has no effect. When | |
33 // shutting down this method must be called for each channel pending creation. | |
34 virtual void CancelChannelCreation(const std::string& name) = 0; | |
35 | |
36 protected: | |
37 virtual ~DatagramChannelFactory() {} | |
38 | |
39 private: | |
40 DISALLOW_COPY_AND_ASSIGN(DatagramChannelFactory); | |
41 }; | |
42 | |
43 } // namespace protocol | |
44 } // namespace remoting | |
45 | |
46 #endif // REMOTING_PROTOCOL_DATAGRAM_CHANNEL_FACTORY_H_ | |
OLD | NEW |