Index: net/base/net_util.cc |
diff --git a/net/base/net_util.cc b/net/base/net_util.cc |
index 106486df248e47db22675b669da71739ba546ba0..aa1863394829f155cdcddb17d2ea7edbeb523e9d 100644 |
--- a/net/base/net_util.cc |
+++ b/net/base/net_util.cc |
@@ -17,6 +17,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> |
@@ -1195,6 +1196,22 @@ bool GetIPAddressFromSockAddr(const struct sockaddr* sock_addr, |
return true; |
} |
+#if defined(OS_WIN) |
+ // Bluetooth address size. Windows bluetooth is supported via winsock. |
wtc
2014/04/24 23:09:31
Nit: capitalize "bluetooth".
xiyuan
2014/04/25 20:29:29
Done.
|
+ const size_t kBtAddressSize = 6; |
wtc
2014/04/24 23:09:31
1. Nit: it seems better to use "Bth" instead of "B
xiyuan
2014/04/25 20:29:29
Done.
|
+ 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 = kBtAddressSize; |
+ if (port) |
+ *port = addr->port; |
wtc
2014/04/24 23:09:31
This doesn't extract the serviceClassId member of
xiyuan
2014/04/25 20:29:29
serviceClassId is a way to map to a port(aka Bt ch
|
+ return true; |
+ } |
+#endif |
+ |
return false; // Unrecognized |sa_family|. |
} |