OLD | NEW |
| (Empty) |
1 /* | |
2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. | |
3 * | |
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. | |
9 */ | |
10 | |
11 #ifndef WEBRTC_LIBJINGLE_SESSION_P2PTRANSPORTPARSER_H_ | |
12 #define WEBRTC_LIBJINGLE_SESSION_P2PTRANSPORTPARSER_H_ | |
13 | |
14 #include <string> | |
15 #include "webrtc/libjingle/session/transportparser.h" | |
16 | |
17 namespace cricket { | |
18 | |
19 class P2PTransportParser : public TransportParser { | |
20 public: | |
21 P2PTransportParser() {} | |
22 // Translator may be null, in which case ParseCandidates should | |
23 // return false if there are candidates to parse. We can't not call | |
24 // ParseCandidates because there's no way to know ahead of time if | |
25 // there are candidates or not. | |
26 | |
27 // Jingle-specific functions; can be used with either ICE, GICE, or HYBRID. | |
28 virtual bool ParseTransportDescription(const buzz::XmlElement* elem, | |
29 const CandidateTranslator* translator, | |
30 TransportDescription* desc, | |
31 ParseError* error); | |
32 virtual bool WriteTransportDescription(const TransportDescription& desc, | |
33 const CandidateTranslator* translator, | |
34 buzz::XmlElement** elem, | |
35 WriteError* error); | |
36 | |
37 // Legacy Gingle functions; only can be used with GICE. | |
38 virtual bool ParseGingleCandidate(const buzz::XmlElement* elem, | |
39 const CandidateTranslator* translator, | |
40 Candidate* candidate, | |
41 ParseError* error); | |
42 virtual bool WriteGingleCandidate(const Candidate& candidate, | |
43 const CandidateTranslator* translator, | |
44 buzz::XmlElement** elem, | |
45 WriteError* error); | |
46 | |
47 private: | |
48 bool ParseCandidate(TransportProtocol proto, | |
49 const buzz::XmlElement* elem, | |
50 const CandidateTranslator* translator, | |
51 Candidate* candidate, | |
52 ParseError* error); | |
53 bool WriteCandidate(TransportProtocol proto, | |
54 const Candidate& candidate, | |
55 const CandidateTranslator* translator, | |
56 buzz::XmlElement* elem, | |
57 WriteError* error); | |
58 bool VerifyUsernameFormat(TransportProtocol proto, | |
59 const std::string& username, | |
60 ParseError* error); | |
61 | |
62 DISALLOW_COPY_AND_ASSIGN(P2PTransportParser); | |
63 }; | |
64 | |
65 } // namespace cricket | |
66 | |
67 #endif // WEBRTC_LIBJINGLE_SESSION_P2PTRANSPORTPARSER_H_ | |
OLD | NEW |