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
;
17 class P2PDatagramSocket
;
19 // StreamChannelFactory that creates PseudoTCP-based stream channels that run on
20 // top of datagram channels created using specified |datagram_channel_factory|.
21 class PseudoTcpChannelFactory
: public StreamChannelFactory
{
23 // |datagram_channel_factory| must outlive this object.
24 explicit PseudoTcpChannelFactory(
25 DatagramChannelFactory
* datagram_channel_factory
);
26 ~PseudoTcpChannelFactory() override
;
28 // StreamChannelFactory interface.
29 void CreateChannel(const std::string
& name
,
30 const ChannelCreatedCallback
& callback
) override
;
31 void CancelChannelCreation(const std::string
& name
) override
;
34 typedef std::map
<std::string
, P2PStreamSocket
*> PendingSocketsMap
;
36 void OnDatagramChannelCreated(const std::string
& name
,
37 const ChannelCreatedCallback
& callback
,
38 scoped_ptr
<P2PDatagramSocket
> socket
);
39 void OnPseudoTcpConnected(const std::string
& name
,
40 const ChannelCreatedCallback
& callback
,
43 DatagramChannelFactory
* datagram_channel_factory_
;
45 PendingSocketsMap pending_sockets_
;
47 DISALLOW_COPY_AND_ASSIGN(PseudoTcpChannelFactory
);
50 } // namespace protocol
51 } // namespace remoting
53 #endif // REMOTING_PROTOCOL_PSEUDOTCP_CHANNEL_FACTORY_H_