| 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_TRANSPORTPARSER_H_ | |
| 12 #define WEBRTC_LIBJINGLE_SESSION_TRANSPORTPARSER_H_ | |
| 13 | |
| 14 #include <string> | |
| 15 #include <vector> | |
| 16 | |
| 17 #include "webrtc/p2p/base/transportinfo.h" | |
| 18 | |
| 19 namespace buzz { | |
| 20 class QName; | |
| 21 class XmlElement; | |
| 22 } | |
| 23 | |
| 24 namespace cricket { | |
| 25 | |
| 26 struct ParseError; | |
| 27 struct WriteError; | |
| 28 class CandidateTranslator; | |
| 29 | |
| 30 typedef std::vector<buzz::XmlElement*> XmlElements; | |
| 31 | |
| 32 class TransportParser { | |
| 33 public: | |
| 34 // The incoming Translator value may be null, in which case | |
| 35 // ParseCandidates should return false if there are candidates to | |
| 36 // parse (indicating a failure to parse). If the Translator is null | |
| 37 // and there are no candidates to parse, then return true, | |
| 38 // indicating a successful parse of 0 candidates. | |
| 39 | |
| 40 // Parse or write a transport description, including ICE credentials and | |
| 41 // any DTLS fingerprint. Since only Jingle has transport descriptions, these | |
| 42 // functions are only used when serializing to Jingle. | |
| 43 virtual bool ParseTransportDescription(const buzz::XmlElement* elem, | |
| 44 const CandidateTranslator* translator, | |
| 45 TransportDescription* tdesc, | |
| 46 ParseError* error) = 0; | |
| 47 virtual bool WriteTransportDescription(const TransportDescription& tdesc, | |
| 48 const CandidateTranslator* translator, | |
| 49 buzz::XmlElement** tdesc_elem, | |
| 50 WriteError* error) = 0; | |
| 51 | |
| 52 | |
| 53 // Parse a single candidate. This must be used when parsing Gingle | |
| 54 // candidates, since there is no enclosing transport description. | |
| 55 virtual bool ParseGingleCandidate(const buzz::XmlElement* elem, | |
| 56 const CandidateTranslator* translator, | |
| 57 Candidate* candidates, | |
| 58 ParseError* error) = 0; | |
| 59 virtual bool WriteGingleCandidate(const Candidate& candidate, | |
| 60 const CandidateTranslator* translator, | |
| 61 buzz::XmlElement** candidate_elem, | |
| 62 WriteError* error) = 0; | |
| 63 | |
| 64 // Helper function to parse an element describing an address. This | |
| 65 // retrieves the IP and port from the given element and verifies | |
| 66 // that they look like plausible values. | |
| 67 bool ParseAddress(const buzz::XmlElement* elem, | |
| 68 const buzz::QName& address_name, | |
| 69 const buzz::QName& port_name, | |
| 70 rtc::SocketAddress* address, | |
| 71 ParseError* error); | |
| 72 | |
| 73 virtual ~TransportParser() {} | |
| 74 }; | |
| 75 | |
| 76 } // namespace cricket | |
| 77 | |
| 78 #endif // WEBRTC_LIBJINGLE_SESSION_TRANSPORTPARSER_H_ | |
| OLD | NEW |