| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "net/dns/dns_transaction.h" | 5 #include "net/dns/dns_transaction.h" |
| 6 | 6 |
| 7 #include <deque> | 7 #include <deque> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 for (size_t i = 0; i < name.size() && name[i]; i += name[i] + 1) | 50 for (size_t i = 0; i < name.size() && name[i]; i += name[i] + 1) |
| 51 ++count; | 51 ++count; |
| 52 return count; | 52 return count; |
| 53 } | 53 } |
| 54 | 54 |
| 55 bool IsIPLiteral(const std::string& hostname) { | 55 bool IsIPLiteral(const std::string& hostname) { |
| 56 IPAddressNumber ip; | 56 IPAddressNumber ip; |
| 57 return ParseIPLiteralToNumber(hostname, &ip); | 57 return ParseIPLiteralToNumber(hostname, &ip); |
| 58 } | 58 } |
| 59 | 59 |
| 60 Value* NetLogStartCallback(const std::string* hostname, | 60 base::Value* NetLogStartCallback(const std::string* hostname, |
| 61 uint16 qtype, | 61 uint16 qtype, |
| 62 NetLog::LogLevel /* log_level */) { | 62 NetLog::LogLevel /* log_level */) { |
| 63 DictionaryValue* dict = new DictionaryValue(); | 63 base::DictionaryValue* dict = new base::DictionaryValue(); |
| 64 dict->SetString("hostname", *hostname); | 64 dict->SetString("hostname", *hostname); |
| 65 dict->SetInteger("query_type", qtype); | 65 dict->SetInteger("query_type", qtype); |
| 66 return dict; | 66 return dict; |
| 67 }; | 67 }; |
| 68 | 68 |
| 69 // ---------------------------------------------------------------------------- | 69 // ---------------------------------------------------------------------------- |
| 70 | 70 |
| 71 // A single asynchronous DNS exchange, which consists of sending out a | 71 // A single asynchronous DNS exchange, which consists of sending out a |
| 72 // DNS query, waiting for a response, and returning the response that it | 72 // DNS query, waiting for a response, and returning the response that it |
| 73 // matches. Logging is done in the socket and in the outer DnsTransaction. | 73 // matches. Logging is done in the socket and in the outer DnsTransaction. |
| (...skipping 19 matching lines...) Expand all Loading... |
| 93 | 93 |
| 94 // Returns the index of the destination server within DnsConfig::nameservers. | 94 // Returns the index of the destination server within DnsConfig::nameservers. |
| 95 unsigned server_index() const { return server_index_; } | 95 unsigned server_index() const { return server_index_; } |
| 96 | 96 |
| 97 // Returns a Value representing the received response, along with a reference | 97 // Returns a Value representing the received response, along with a reference |
| 98 // to the NetLog source source of the UDP socket used. The request must have | 98 // to the NetLog source source of the UDP socket used. The request must have |
| 99 // completed before this is called. | 99 // completed before this is called. |
| 100 Value* NetLogResponseCallback(NetLog::LogLevel log_level) const { | 100 Value* NetLogResponseCallback(NetLog::LogLevel log_level) const { |
| 101 DCHECK(GetResponse()->IsValid()); | 101 DCHECK(GetResponse()->IsValid()); |
| 102 | 102 |
| 103 DictionaryValue* dict = new DictionaryValue(); | 103 base::DictionaryValue* dict = new base::DictionaryValue(); |
| 104 dict->SetInteger("rcode", GetResponse()->rcode()); | 104 dict->SetInteger("rcode", GetResponse()->rcode()); |
| 105 dict->SetInteger("answer_count", GetResponse()->answer_count()); | 105 dict->SetInteger("answer_count", GetResponse()->answer_count()); |
| 106 GetSocketNetLog().source().AddToEventParameters(dict); | 106 GetSocketNetLog().source().AddToEventParameters(dict); |
| 107 return dict; | 107 return dict; |
| 108 } | 108 } |
| 109 | 109 |
| 110 void set_result(int result) { | 110 void set_result(int result) { |
| 111 result_ = result; | 111 result_ = result; |
| 112 } | 112 } |
| 113 | 113 |
| (...skipping 837 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 951 } // namespace | 951 } // namespace |
| 952 | 952 |
| 953 // static | 953 // static |
| 954 scoped_ptr<DnsTransactionFactory> DnsTransactionFactory::CreateFactory( | 954 scoped_ptr<DnsTransactionFactory> DnsTransactionFactory::CreateFactory( |
| 955 DnsSession* session) { | 955 DnsSession* session) { |
| 956 return scoped_ptr<DnsTransactionFactory>( | 956 return scoped_ptr<DnsTransactionFactory>( |
| 957 new DnsTransactionFactoryImpl(session)); | 957 new DnsTransactionFactoryImpl(session)); |
| 958 } | 958 } |
| 959 | 959 |
| 960 } // namespace net | 960 } // namespace net |
| OLD | NEW |