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.
5 #ifndef REMOTING_PROTOCOL_PSEUDOTCP_CHANNEL_FACTORY_H_
6 #define REMOTING_PROTOCOL_PSEUDOTCP_CHANNEL_FACTORY_H_
10 #include "base/basictypes.h"
11 #include "remoting/protocol/stream_channel_factory.h"
16 class DatagramChannelFactory
;
18 // StreamChannelFactory that creates PseudoTCP-based stream channels that run on
19 // top of datagram channels created using specified |datagram_channel_factory|.
20 class PseudoTcpChannelFactory
: public StreamChannelFactory
{
22 // |datagram_channel_factory| must outlive this object.
23 explicit PseudoTcpChannelFactory(
24 DatagramChannelFactory
* datagram_channel_factory
);
25 ~PseudoTcpChannelFactory() override
;
27 // StreamChannelFactory interface.
28 void CreateChannel(const std::string
& name
,
29 const ChannelCreatedCallback
& callback
) override
;
30 void CancelChannelCreation(const std::string
& name
) override
;
33 typedef std::map
<std::string
, net::StreamSocket
*> PendingSocketsMap
;
35 void OnDatagramChannelCreated(const std::string
& name
,
36 const ChannelCreatedCallback
& callback
,
37 scoped_ptr
<net::Socket
> socket
);
38 void OnPseudoTcpConnected(const std::string
& name
,
39 const ChannelCreatedCallback
& callback
,
42 DatagramChannelFactory
* datagram_channel_factory_
;
44 PendingSocketsMap pending_sockets_
;
46 DISALLOW_COPY_AND_ASSIGN(PseudoTcpChannelFactory
);
49 } // namespace protocol
50 } // namespace remoting
52 #endif // REMOTING_PROTOCOL_PSEUDOTCP_CHANNEL_FACTORY_H_