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 #include "webrtc/libjingle/session/transportparser.h" | |
12 | |
13 #include "webrtc/libjingle/session/parsing.h" | |
14 #include "webrtc/libjingle/xmllite/xmlelement.h" | |
15 #include "webrtc/libjingle/xmpp/constants.h" | |
16 | |
17 namespace cricket { | |
18 | |
19 bool TransportParser::ParseAddress(const buzz::XmlElement* elem, | |
20 const buzz::QName& address_name, | |
21 const buzz::QName& port_name, | |
22 rtc::SocketAddress* address, | |
23 ParseError* error) { | |
24 if (!elem->HasAttr(address_name)) | |
25 return BadParse("address does not have " + address_name.LocalPart(), error); | |
26 if (!elem->HasAttr(port_name)) | |
27 return BadParse("address does not have " + port_name.LocalPart(), error); | |
28 | |
29 address->SetIP(elem->Attr(address_name)); | |
30 std::istringstream ist(elem->Attr(port_name)); | |
31 int port = 0; | |
32 ist >> port; | |
33 address->SetPort(port); | |
34 | |
35 return true; | |
36 } | |
37 | |
38 } // namespace cricket | |
OLD | NEW |