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

Unified Diff: net/base/address_list.cc

Issue 155618: Use manually constructed IPv6 socket addresses for tests, rather than system ... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: sync Created 11 years, 5 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/address_list.h ('k') | net/base/host_resolver_impl_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/base/address_list.cc
===================================================================
--- net/base/address_list.cc (revision 21052)
+++ net/base/address_list.cc (working copy)
@@ -127,6 +127,25 @@
data_ = NULL;
}
+// static
+AddressList AddressList::CreateIPv6Address(unsigned char data[16]) {
+ struct addrinfo* ai = new struct addrinfo;
+ memset(ai, 0, sizeof(struct addrinfo));
+
+ ai->ai_family = AF_INET6;
+ ai->ai_socktype = SOCK_STREAM;
+ ai->ai_addrlen = sizeof(sockaddr_in6);
+
+ struct sockaddr_in6* addr6 = new sockaddr_in6;
+ memset(addr6, 0, sizeof(sockaddr_in6));
+
+ ai->ai_addr = reinterpret_cast<sockaddr*>(addr6);
+ addr6->sin6_family = AF_INET6;
+ memcpy(&addr6->sin6_addr, data, 16);
+
+ return AddressList(new Data(ai, false /*is_system_created*/));
+}
+
AddressList::Data::~Data() {
// Call either freeaddrinfo(head), or FreeMyAddrinfo(head), depending who
// created the data.
« no previous file with comments | « net/base/address_list.h ('k') | net/base/host_resolver_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698