Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(497)

Unified Diff: jingle/glue/utils.cc

Issue 1405963021: Add support for default local address in IpcNetworkManager (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix a sizeof Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « jingle/glue/utils.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: jingle/glue/utils.cc
diff --git a/jingle/glue/utils.cc b/jingle/glue/utils.cc
index 4c9f4b681029ab9c8cc4df2bd18e834335eb3107..130d0e372b635a1e471b0d2b7064000866a9e32e 100644
--- a/jingle/glue/utils.cc
+++ b/jingle/glue/utils.cc
@@ -33,6 +33,22 @@ bool SocketAddressToIPEndPoint(const rtc::SocketAddress& address,
ip_endpoint->FromSockAddr(reinterpret_cast<sockaddr*>(&addr), size);
}
+rtc::IPAddress IPAddressNumberToIPAddress(
+ const net::IPAddressNumber& ip_address_number) {
+ if (ip_address_number.size() == net::kIPv4AddressSize) {
+ uint32_t address;
+ memcpy(&address, &ip_address_number[0], sizeof(uint32_t));
+ address = rtc::NetworkToHost32(address);
+ return rtc::IPAddress(address);
+ }
+ if (ip_address_number.size() == net::kIPv6AddressSize) {
+ in6_addr address;
+ memcpy(&address, &ip_address_number[0], sizeof(in6_addr));
+ return rtc::IPAddress(address);
+ }
+ return rtc::IPAddress();
+}
+
std::string SerializeP2PCandidate(const cricket::Candidate& candidate) {
// TODO(sergeyu): Use SDP to format candidates?
base::DictionaryValue value;
« no previous file with comments | « jingle/glue/utils.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698