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

Side by Side Diff: net/dns/dns_transaction.h

Issue 1535363003: Switch to standard integer types in net/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: stddef Created 5 years 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 unified diff | Download patch
« no previous file with comments | « net/dns/dns_test_util.cc ('k') | net/dns/dns_transaction.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #ifndef NET_DNS_DNS_TRANSACTION_H_ 5 #ifndef NET_DNS_DNS_TRANSACTION_H_
6 #define NET_DNS_DNS_TRANSACTION_H_ 6 #define NET_DNS_DNS_TRANSACTION_H_
7 7
8 #include <stdint.h>
9
8 #include <string> 10 #include <string>
9 11
10 #include "base/basictypes.h"
11 #include "base/callback_forward.h" 12 #include "base/callback_forward.h"
12 #include "base/memory/scoped_ptr.h" 13 #include "base/memory/scoped_ptr.h"
13 #include "net/base/net_export.h" 14 #include "net/base/net_export.h"
14 15
15 namespace net { 16 namespace net {
16 17
17 class BoundNetLog; 18 class BoundNetLog;
18 class DnsResponse; 19 class DnsResponse;
19 class DnsSession; 20 class DnsSession;
20 21
21 // DnsTransaction implements a stub DNS resolver as defined in RFC 1034. 22 // DnsTransaction implements a stub DNS resolver as defined in RFC 1034.
22 // The DnsTransaction takes care of retransmissions, name server fallback (or 23 // The DnsTransaction takes care of retransmissions, name server fallback (or
23 // round-robin), suffix search, and simple response validation ("does it match 24 // round-robin), suffix search, and simple response validation ("does it match
24 // the query") to fight poisoning. 25 // the query") to fight poisoning.
25 // 26 //
26 // Destroying DnsTransaction cancels the underlying network effort. 27 // Destroying DnsTransaction cancels the underlying network effort.
27 class NET_EXPORT_PRIVATE DnsTransaction { 28 class NET_EXPORT_PRIVATE DnsTransaction {
28 public: 29 public:
29 virtual ~DnsTransaction() {} 30 virtual ~DnsTransaction() {}
30 31
31 // Returns the original |hostname|. 32 // Returns the original |hostname|.
32 virtual const std::string& GetHostname() const = 0; 33 virtual const std::string& GetHostname() const = 0;
33 34
34 // Returns the |qtype|. 35 // Returns the |qtype|.
35 virtual uint16 GetType() const = 0; 36 virtual uint16_t GetType() const = 0;
36 37
37 // Starts the transaction. Always completes asynchronously. 38 // Starts the transaction. Always completes asynchronously.
38 virtual void Start() = 0; 39 virtual void Start() = 0;
39 }; 40 };
40 41
41 // Creates DnsTransaction which performs asynchronous DNS search. 42 // Creates DnsTransaction which performs asynchronous DNS search.
42 // It does NOT perform caching, aggregation or prioritization of transactions. 43 // It does NOT perform caching, aggregation or prioritization of transactions.
43 // 44 //
44 // Destroying the factory does NOT affect any already created DnsTransactions. 45 // Destroying the factory does NOT affect any already created DnsTransactions.
45 class NET_EXPORT_PRIVATE DnsTransactionFactory { 46 class NET_EXPORT_PRIVATE DnsTransactionFactory {
46 public: 47 public:
47 // Called with the response or NULL if no matching response was received. 48 // Called with the response or NULL if no matching response was received.
48 // Note that the |GetDottedName()| of the response may be different than the 49 // Note that the |GetDottedName()| of the response may be different than the
49 // original |hostname| as a result of suffix search. 50 // original |hostname| as a result of suffix search.
50 typedef base::Callback<void(DnsTransaction* transaction, 51 typedef base::Callback<void(DnsTransaction* transaction,
51 int neterror, 52 int neterror,
52 const DnsResponse* response)> CallbackType; 53 const DnsResponse* response)> CallbackType;
53 54
54 virtual ~DnsTransactionFactory() {} 55 virtual ~DnsTransactionFactory() {}
55 56
56 // Creates DnsTransaction for the given |hostname| and |qtype| (assuming 57 // Creates DnsTransaction for the given |hostname| and |qtype| (assuming
57 // QCLASS is IN). |hostname| should be in the dotted form. A dot at the end 58 // QCLASS is IN). |hostname| should be in the dotted form. A dot at the end
58 // implies the domain name is fully-qualified and will be exempt from suffix 59 // implies the domain name is fully-qualified and will be exempt from suffix
59 // search. |hostname| should not be an IP literal. 60 // search. |hostname| should not be an IP literal.
60 // 61 //
61 // The transaction will run |callback| upon asynchronous completion. 62 // The transaction will run |callback| upon asynchronous completion.
62 // The |net_log| is used as the parent log. 63 // The |net_log| is used as the parent log.
63 virtual scoped_ptr<DnsTransaction> CreateTransaction( 64 virtual scoped_ptr<DnsTransaction> CreateTransaction(
64 const std::string& hostname, 65 const std::string& hostname,
65 uint16 qtype, 66 uint16_t qtype,
66 const CallbackType& callback, 67 const CallbackType& callback,
67 const BoundNetLog& net_log) WARN_UNUSED_RESULT = 0; 68 const BoundNetLog& net_log) WARN_UNUSED_RESULT = 0;
68 69
69 // Creates a DnsTransactionFactory which creates DnsTransactionImpl using the 70 // Creates a DnsTransactionFactory which creates DnsTransactionImpl using the
70 // |session|. 71 // |session|.
71 static scoped_ptr<DnsTransactionFactory> CreateFactory( 72 static scoped_ptr<DnsTransactionFactory> CreateFactory(
72 DnsSession* session) WARN_UNUSED_RESULT; 73 DnsSession* session) WARN_UNUSED_RESULT;
73 }; 74 };
74 75
75 } // namespace net 76 } // namespace net
76 77
77 #endif // NET_DNS_DNS_TRANSACTION_H_ 78 #endif // NET_DNS_DNS_TRANSACTION_H_
78 79
OLDNEW
« no previous file with comments | « net/dns/dns_test_util.cc ('k') | net/dns/dns_transaction.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698