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

Unified Diff: net/base/net_util.cc

Issue 236203018: win: Implement Bluetooth server. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 8 months 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 | « net/base/net_util.h ('k') | net/socket/tcp_socket_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/base/net_util.cc
diff --git a/net/base/net_util.cc b/net/base/net_util.cc
index 3694ea8c5871035da075c05b3eb7cc7fcea56974..b08dbfa9f5288f7290512718a5a4bfdfd1bcfe05 100644
--- a/net/base/net_util.cc
+++ b/net/base/net_util.cc
@@ -16,6 +16,7 @@
#include <windows.h>
#include <iphlpapi.h>
#include <winsock2.h>
+#include <ws2bth.h>
#pragma comment(lib, "iphlpapi.lib")
#elif defined(OS_POSIX)
#include <fcntl.h>
@@ -524,13 +525,27 @@ bool GetIPAddressFromSockAddr(const struct sockaddr* sock_addr,
return false;
const struct sockaddr_in6* addr =
reinterpret_cast<const struct sockaddr_in6*>(sock_addr);
- *address = reinterpret_cast<const unsigned char*>(&addr->sin6_addr);
+ *address = reinterpret_cast<const uint8*>(&addr->sin6_addr);
*address_len = kIPv6AddressSize;
if (port)
*port = base::NetToHost16(addr->sin6_port);
return true;
}
+#if defined(OS_WIN)
+ if (sock_addr->sa_family == AF_BTH) {
+ if (sock_addr_len < static_cast<socklen_t>(sizeof(SOCKADDR_BTH)))
+ return false;
+ const SOCKADDR_BTH* addr =
+ reinterpret_cast<const SOCKADDR_BTH*>(sock_addr);
+ *address = reinterpret_cast<const uint8*>(&addr->btAddr);
+ *address_len = kBluetoothAddressSize;
+ if (port)
+ *port = addr->port;
+ return true;
+ }
+#endif
+
return false; // Unrecognized |sa_family|.
}
« no previous file with comments | « net/base/net_util.h ('k') | net/socket/tcp_socket_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698