2 * Copyright 2004 The WebRTC Project Authors. All rights reserved.
4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
11 #ifndef WEBRTC_P2P_BASE_RAWTRANSPORT_H_
12 #define WEBRTC_P2P_BASE_RAWTRANSPORT_H_
15 #include "webrtc/p2p/base/transport.h"
17 #if defined(FEATURE_ENABLE_PSTN)
20 // Implements a transport that only sends raw packets, no STUN. As a result,
21 // it cannot do pings to determine connectivity, so it only uses a single port
22 // that it thinks will work.
23 class RawTransport : public Transport, public TransportParser {
25 RawTransport(rtc::Thread* signaling_thread,
26 rtc::Thread* worker_thread,
27 const std::string& content_name,
28 PortAllocator* allocator);
29 virtual ~RawTransport();
31 virtual bool ParseCandidates(SignalingProtocol protocol,
32 const buzz::XmlElement* elem,
33 const CandidateTranslator* translator,
34 Candidates* candidates,
36 virtual bool WriteCandidates(SignalingProtocol protocol,
37 const Candidates& candidates,
38 const CandidateTranslator* translator,
39 XmlElements* candidate_elems,
43 // Creates and destroys raw channels.
44 virtual TransportChannelImpl* CreateTransportChannel(int component);
45 virtual void DestroyTransportChannel(TransportChannelImpl* channel);
48 // Parses the given element, which should describe the address to use for a
49 // given channel. This will return false and signal an error if the address
50 // or channel name is bad.
51 bool ParseRawAddress(const buzz::XmlElement* elem,
52 rtc::SocketAddress* addr,
55 friend class RawTransportChannel; // For ParseAddress.
57 DISALLOW_EVIL_CONSTRUCTORS(RawTransport);
60 } // namespace cricket
62 #endif // defined(FEATURE_ENABLE_PSTN)
64 #endif // WEBRTC_P2P_BASE_RAWTRANSPORT_H_