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

Side by Side Diff: net/dns/mdns_client.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/mdns_cache_unittest.cc ('k') | net/dns/mdns_client.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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_MDNS_CLIENT_H_ 5 #ifndef NET_DNS_MDNS_CLIENT_H_
6 #define NET_DNS_MDNS_CLIENT_H_ 6 #define NET_DNS_MDNS_CLIENT_H_
7 7
8 #include <stdint.h>
9
8 #include <string> 10 #include <string>
9 #include <vector> 11 #include <vector>
10 12
11 #include "base/callback.h" 13 #include "base/callback.h"
12 #include "base/memory/scoped_ptr.h" 14 #include "base/memory/scoped_ptr.h"
13 #include "net/base/ip_endpoint.h" 15 #include "net/base/ip_endpoint.h"
14 #include "net/dns/dns_query.h" 16 #include "net/dns/dns_query.h"
15 #include "net/dns/dns_response.h" 17 #include "net/dns/dns_response.h"
16 #include "net/dns/record_parsed.h" 18 #include "net/dns/record_parsed.h"
17 19
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 virtual ~MDnsTransaction() {} 71 virtual ~MDnsTransaction() {}
70 72
71 // Start the transaction. Return true on success. Cache-based transactions 73 // Start the transaction. Return true on success. Cache-based transactions
72 // will execute the callback synchronously. 74 // will execute the callback synchronously.
73 virtual bool Start() = 0; 75 virtual bool Start() = 0;
74 76
75 // Get the host or service name for the transaction. 77 // Get the host or service name for the transaction.
76 virtual const std::string& GetName() const = 0; 78 virtual const std::string& GetName() const = 0;
77 79
78 // Get the type for this transaction (SRV, TXT, A, AAA, etc) 80 // Get the type for this transaction (SRV, TXT, A, AAA, etc)
79 virtual uint16 GetType() const = 0; 81 virtual uint16_t GetType() const = 0;
80 }; 82 };
81 83
82 // A listener listens for updates regarding a specific record or set of records. 84 // A listener listens for updates regarding a specific record or set of records.
83 // Created by the MDnsClient (see |MDnsClient::CreateListener|) and used to keep 85 // Created by the MDnsClient (see |MDnsClient::CreateListener|) and used to keep
84 // track of listeners. 86 // track of listeners.
85 class NET_EXPORT MDnsListener { 87 class NET_EXPORT MDnsListener {
86 public: 88 public:
87 // Used in the MDnsListener delegate to signify what type of change has been 89 // Used in the MDnsListener delegate to signify what type of change has been
88 // made to a record. 90 // made to a record.
89 enum UpdateType { 91 enum UpdateType {
(...skipping 25 matching lines...) Expand all
115 virtual bool Start() = 0; 117 virtual bool Start() = 0;
116 118
117 // Actively refresh any received records. 119 // Actively refresh any received records.
118 virtual void SetActiveRefresh(bool active_refresh) = 0; 120 virtual void SetActiveRefresh(bool active_refresh) = 0;
119 121
120 // Get the host or service name for this query. 122 // Get the host or service name for this query.
121 // Return an empty string for no name. 123 // Return an empty string for no name.
122 virtual const std::string& GetName() const = 0; 124 virtual const std::string& GetName() const = 0;
123 125
124 // Get the type for this query (SRV, TXT, A, AAA, etc) 126 // Get the type for this query (SRV, TXT, A, AAA, etc)
125 virtual uint16 GetType() const = 0; 127 virtual uint16_t GetType() const = 0;
126 }; 128 };
127 129
128 // Creates bound datagram sockets ready to use by MDnsClient. 130 // Creates bound datagram sockets ready to use by MDnsClient.
129 class NET_EXPORT MDnsSocketFactory { 131 class NET_EXPORT MDnsSocketFactory {
130 public: 132 public:
131 virtual ~MDnsSocketFactory() {} 133 virtual ~MDnsSocketFactory() {}
132 virtual void CreateSockets( 134 virtual void CreateSockets(
133 std::vector<scoped_ptr<DatagramServerSocket>>* sockets) = 0; 135 std::vector<scoped_ptr<DatagramServerSocket>>* sockets) = 0;
134 136
135 static scoped_ptr<MDnsSocketFactory> CreateDefault(); 137 static scoped_ptr<MDnsSocketFactory> CreateDefault();
136 }; 138 };
137 139
138 // Listens for Multicast DNS on the local network. You can access information 140 // Listens for Multicast DNS on the local network. You can access information
139 // regarding multicast DNS either by creating an |MDnsListener| to be notified 141 // regarding multicast DNS either by creating an |MDnsListener| to be notified
140 // of new records, or by creating an |MDnsTransaction| to look up the value of a 142 // of new records, or by creating an |MDnsTransaction| to look up the value of a
141 // specific records. When all listeners and active transactions are destroyed, 143 // specific records. When all listeners and active transactions are destroyed,
142 // the client stops listening on the network and destroys the cache. 144 // the client stops listening on the network and destroys the cache.
143 class NET_EXPORT MDnsClient { 145 class NET_EXPORT MDnsClient {
144 public: 146 public:
145 virtual ~MDnsClient() {} 147 virtual ~MDnsClient() {}
146 148
147 // Create listener object for RRType |rrtype| and name |name|. 149 // Create listener object for RRType |rrtype| and name |name|.
148 virtual scoped_ptr<MDnsListener> CreateListener( 150 virtual scoped_ptr<MDnsListener> CreateListener(
149 uint16 rrtype, 151 uint16_t rrtype,
150 const std::string& name, 152 const std::string& name,
151 MDnsListener::Delegate* delegate) = 0; 153 MDnsListener::Delegate* delegate) = 0;
152 154
153 // Create a transaction that can be used to query either the MDns cache, the 155 // Create a transaction that can be used to query either the MDns cache, the
154 // network, or both for records of type |rrtype| and name |name|. |flags| is 156 // network, or both for records of type |rrtype| and name |name|. |flags| is
155 // defined by MDnsTransactionFlags. 157 // defined by MDnsTransactionFlags.
156 virtual scoped_ptr<MDnsTransaction> CreateTransaction( 158 virtual scoped_ptr<MDnsTransaction> CreateTransaction(
157 uint16 rrtype, 159 uint16_t rrtype,
158 const std::string& name, 160 const std::string& name,
159 int flags, 161 int flags,
160 const MDnsTransaction::ResultCallback& callback) = 0; 162 const MDnsTransaction::ResultCallback& callback) = 0;
161 163
162 virtual bool StartListening(MDnsSocketFactory* factory) = 0; 164 virtual bool StartListening(MDnsSocketFactory* factory) = 0;
163 165
164 // Do not call this inside callbacks from related MDnsListener and 166 // Do not call this inside callbacks from related MDnsListener and
165 // MDnsTransaction objects. 167 // MDnsTransaction objects.
166 virtual void StopListening() = 0; 168 virtual void StopListening() = 0;
167 virtual bool IsListening() const = 0; 169 virtual bool IsListening() const = 0;
168 170
169 // Create the default MDnsClient 171 // Create the default MDnsClient
170 static scoped_ptr<MDnsClient> CreateDefault(); 172 static scoped_ptr<MDnsClient> CreateDefault();
171 }; 173 };
172 174
173 NET_EXPORT IPEndPoint GetMDnsIPEndPoint(AddressFamily address_family); 175 NET_EXPORT IPEndPoint GetMDnsIPEndPoint(AddressFamily address_family);
174 176
175 typedef std::vector<std::pair<uint32, AddressFamily> > InterfaceIndexFamilyList; 177 typedef std::vector<std::pair<uint32_t, AddressFamily>>
178 InterfaceIndexFamilyList;
176 // Returns pairs of interface and address family to bind. Current 179 // Returns pairs of interface and address family to bind. Current
177 // implementation returns unique list of all available interfaces. 180 // implementation returns unique list of all available interfaces.
178 NET_EXPORT InterfaceIndexFamilyList GetMDnsInterfacesToBind(); 181 NET_EXPORT InterfaceIndexFamilyList GetMDnsInterfacesToBind();
179 182
180 // Create sockets, binds socket to MDns endpoint, and sets multicast interface 183 // Create sockets, binds socket to MDns endpoint, and sets multicast interface
181 // and joins multicast group on for |interface_index|. 184 // and joins multicast group on for |interface_index|.
182 // Returns NULL if failed. 185 // Returns NULL if failed.
183 NET_EXPORT scoped_ptr<DatagramServerSocket> CreateAndBindMDnsSocket( 186 NET_EXPORT scoped_ptr<DatagramServerSocket> CreateAndBindMDnsSocket(
184 AddressFamily address_family, 187 AddressFamily address_family,
185 uint32 interface_index); 188 uint32_t interface_index);
186 189
187 } // namespace net 190 } // namespace net
188 191
189 #endif // NET_DNS_MDNS_CLIENT_H_ 192 #endif // NET_DNS_MDNS_CLIENT_H_
OLDNEW
« no previous file with comments | « net/dns/mdns_cache_unittest.cc ('k') | net/dns/mdns_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698