Chromium Code Reviews| Index: jingle/glue/utils.cc |
| diff --git a/jingle/glue/utils.cc b/jingle/glue/utils.cc |
| index 4c9f4b681029ab9c8cc4df2bd18e834335eb3107..0872d31748ccf960e5bc114e6664b4e3e0c3c629 100644 |
| --- a/jingle/glue/utils.cc |
| +++ b/jingle/glue/utils.cc |
| @@ -12,6 +12,7 @@ |
| #include "net/base/ip_endpoint.h" |
| #include "net/base/net_util.h" |
| #include "third_party/webrtc/base/byteorder.h" |
| +#include "third_party/webrtc/base/ipaddress.h" |
| #include "third_party/webrtc/base/socketaddress.h" |
| #include "third_party/webrtc/p2p/base/candidate.h" |
| @@ -33,6 +34,24 @@ bool SocketAddressToIPEndPoint(const rtc::SocketAddress& address, |
| ip_endpoint->FromSockAddr(reinterpret_cast<sockaddr*>(&addr), size); |
| } |
| +bool IPAddressNumberToIPAddress(const net::IPAddressNumber& ip_address_number, |
|
Sergey Ulanov
2015/11/11 21:10:02
Don't really need to return bool here. rtc::IPAddr
|
| + rtc::IPAddress* ip_address) { |
| + if (ip_address_number.size() == net::kIPv4AddressSize) { |
| + uint32 address; |
|
Sergey Ulanov
2015/11/11 21:10:02
Please change this to uint32_t
|
| + memcpy(&address, &ip_address_number[0], sizeof(uint32)); |
| + address = rtc::NetworkToHost32(address); |
| + *ip_address = rtc::IPAddress(address); |
| + return true; |
| + } |
| + if (ip_address_number.size() == net::kIPv6AddressSize) { |
| + in6_addr address; |
| + memcpy(&address, &ip_address_number[0], sizeof(in6_addr)); |
| + *ip_address = rtc::IPAddress(address); |
| + return true; |
| + } |
| + return false; |
| +} |
| + |
| std::string SerializeP2PCandidate(const cricket::Candidate& candidate) { |
| // TODO(sergeyu): Use SDP to format candidates? |
| base::DictionaryValue value; |