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

Unified Diff: net/base/net_util.h

Issue 6394004: Log source ip and port in NetLog. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix DCHECK. Created 9 years, 11 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 | « no previous file | net/base/net_util.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/base/net_util.h
diff --git a/net/base/net_util.h b/net/base/net_util.h
index f53ee7ea7a3e07ea90fec98af2f024c3b01a4407..935eab672778500cc95ba5bb733ca41e73f4edfc 100644
--- a/net/base/net_util.h
+++ b/net/base/net_util.h
@@ -8,8 +8,11 @@
#include "build/build_config.h"
-#ifdef OS_WIN
+#if defined(OS_WIN)
#include <windows.h>
+#include <ws2tcpip.h>
+#elif defined(OS_POSIX)
+#include <sys/socket.h>
#endif
#include <string>
@@ -107,10 +110,14 @@ std::string GetHostAndOptionalPort(const GURL& url);
// Returns the string representation of an address, like "192.168.0.1".
// Returns empty string on failure.
std::string NetAddressToString(const struct addrinfo* net_address);
+std::string NetAddressToString(const struct sockaddr* net_address,
+ socklen_t address_len);
// Same as NetAddressToString, but additionally includes the port number. For
// example: "192.168.0.1:99" or "[::1]:80".
std::string NetAddressToStringWithPort(const struct addrinfo* net_address);
+std::string NetAddressToStringWithPort(const struct sockaddr* net_address,
+ socklen_t address_len);
// Returns the hostname of the current system. Returns empty string on failure.
std::string GetHostName();
@@ -404,11 +411,18 @@ bool IPNumberMatchesPrefix(const IPAddressNumber& ip_number,
size_t prefix_length_in_bits);
// Returns the port field of the sockaddr in |info|.
-uint16* GetPortFieldFromAddrinfo(const struct addrinfo* info);
+const uint16* GetPortFieldFromAddrinfo(const struct addrinfo* info);
+uint16* GetPortFieldFromAddrinfo(struct addrinfo* info);
// Returns the value of |info's| port (in host byte ordering).
int GetPortFromAddrinfo(const struct addrinfo* info);
+// Same except for struct sockaddr.
+const uint16* GetPortFieldFromSockaddr(const struct sockaddr* address,
+ socklen_t address_len);
+int GetPortFromSockaddr(const struct sockaddr* address,
+ socklen_t address_len);
+
} // namespace net
#endif // NET_BASE_NET_UTIL_H_
« no previous file with comments | « no previous file | net/base/net_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698