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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 ++count; | 52 ++count; |
53 return count; | 53 return count; |
54 } | 54 } |
55 | 55 |
56 bool IsIPLiteral(const std::string& hostname) { | 56 bool IsIPLiteral(const std::string& hostname) { |
57 IPAddressNumber ip; | 57 IPAddressNumber ip; |
58 return ParseIPLiteralToNumber(hostname, &ip); | 58 return ParseIPLiteralToNumber(hostname, &ip); |
59 } | 59 } |
60 | 60 |
61 base::Value* NetLogStartCallback(const std::string* hostname, | 61 base::Value* NetLogStartCallback(const std::string* hostname, |
62 uint16 qtype, | 62 uint16 qtype, |
63 NetLog::LogLevel /* log_level */) { | 63 NetLogCaptureMode /* capture_mode */) { |
64 base::DictionaryValue* dict = new base::DictionaryValue(); | 64 base::DictionaryValue* dict = new base::DictionaryValue(); |
65 dict->SetString("hostname", *hostname); | 65 dict->SetString("hostname", *hostname); |
66 dict->SetInteger("query_type", qtype); | 66 dict->SetInteger("query_type", qtype); |
67 return dict; | 67 return dict; |
68 }; | 68 }; |
69 | 69 |
70 // ---------------------------------------------------------------------------- | 70 // ---------------------------------------------------------------------------- |
71 | 71 |
72 // A single asynchronous DNS exchange, which consists of sending out a | 72 // A single asynchronous DNS exchange, which consists of sending out a |
73 // DNS query, waiting for a response, and returning the response that it | 73 // DNS query, waiting for a response, and returning the response that it |
(...skipping 17 matching lines...) Expand all Loading... |
91 | 91 |
92 // Returns the net log bound to the source of the socket. | 92 // Returns the net log bound to the source of the socket. |
93 virtual const BoundNetLog& GetSocketNetLog() const = 0; | 93 virtual const BoundNetLog& GetSocketNetLog() const = 0; |
94 | 94 |
95 // Returns the index of the destination server within DnsConfig::nameservers. | 95 // Returns the index of the destination server within DnsConfig::nameservers. |
96 unsigned server_index() const { return server_index_; } | 96 unsigned server_index() const { return server_index_; } |
97 | 97 |
98 // Returns a Value representing the received response, along with a reference | 98 // Returns a Value representing the received response, along with a reference |
99 // to the NetLog source source of the UDP socket used. The request must have | 99 // to the NetLog source source of the UDP socket used. The request must have |
100 // completed before this is called. | 100 // completed before this is called. |
101 base::Value* NetLogResponseCallback(NetLog::LogLevel log_level) const { | 101 base::Value* NetLogResponseCallback(NetLogCaptureMode capture_mode) const { |
102 DCHECK(GetResponse()->IsValid()); | 102 DCHECK(GetResponse()->IsValid()); |
103 | 103 |
104 base::DictionaryValue* dict = new base::DictionaryValue(); | 104 base::DictionaryValue* dict = new base::DictionaryValue(); |
105 dict->SetInteger("rcode", GetResponse()->rcode()); | 105 dict->SetInteger("rcode", GetResponse()->rcode()); |
106 dict->SetInteger("answer_count", GetResponse()->answer_count()); | 106 dict->SetInteger("answer_count", GetResponse()->answer_count()); |
107 GetSocketNetLog().source().AddToEventParameters(dict); | 107 GetSocketNetLog().source().AddToEventParameters(dict); |
108 return dict; | 108 return dict; |
109 } | 109 } |
110 | 110 |
111 void set_result(int result) { | 111 void set_result(int result) { |
(...skipping 876 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
988 } // namespace | 988 } // namespace |
989 | 989 |
990 // static | 990 // static |
991 scoped_ptr<DnsTransactionFactory> DnsTransactionFactory::CreateFactory( | 991 scoped_ptr<DnsTransactionFactory> DnsTransactionFactory::CreateFactory( |
992 DnsSession* session) { | 992 DnsSession* session) { |
993 return scoped_ptr<DnsTransactionFactory>( | 993 return scoped_ptr<DnsTransactionFactory>( |
994 new DnsTransactionFactoryImpl(session)); | 994 new DnsTransactionFactoryImpl(session)); |
995 } | 995 } |
996 | 996 |
997 } // namespace net | 997 } // namespace net |
OLD | NEW |