OLD | NEW |
---|---|
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 <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/callback.h" | 11 #include "base/callback.h" |
12 #include "net/base/ip_endpoint.h" | 12 #include "net/base/ip_endpoint.h" |
13 #include "net/dns/dns_query.h" | 13 #include "net/dns/dns_query.h" |
14 #include "net/dns/dns_response.h" | 14 #include "net/dns/dns_response.h" |
15 #include "net/dns/record_parsed.h" | 15 #include "net/dns/record_parsed.h" |
16 | 16 |
17 template <typename T> | |
18 class ScopedVector; | |
19 | |
20 namespace net { | 17 namespace net { |
21 | 18 |
22 class DatagramServerSocket; | 19 class DatagramServerSocket; |
23 class RecordParsed; | 20 class RecordParsed; |
24 | 21 |
25 // Represents a one-time record lookup. A transaction takes one | 22 // Represents a one-time record lookup. A transaction takes one |
26 // associated callback (see |MDnsClient::CreateTransaction|) and calls it | 23 // associated callback (see |MDnsClient::CreateTransaction|) and calls it |
27 // whenever a matching record has been found, either from the cache or | 24 // whenever a matching record has been found, either from the cache or |
28 // by querying the network (it may choose to query either or both based on its | 25 // by querying the network (it may choose to query either or both based on its |
29 // creation flags, see MDnsTransactionFlags). Network-based transactions will | 26 // creation flags, see MDnsTransactionFlags). Network-based transactions will |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
124 virtual const std::string& GetName() const = 0; | 121 virtual const std::string& GetName() const = 0; |
125 | 122 |
126 // Get the type for this query (SRV, TXT, A, AAA, etc) | 123 // Get the type for this query (SRV, TXT, A, AAA, etc) |
127 virtual uint16 GetType() const = 0; | 124 virtual uint16 GetType() const = 0; |
128 }; | 125 }; |
129 | 126 |
130 // Creates bound datagram sockets ready to use by MDnsClient. | 127 // Creates bound datagram sockets ready to use by MDnsClient. |
131 class NET_EXPORT MDnsSocketFactory { | 128 class NET_EXPORT MDnsSocketFactory { |
132 public: | 129 public: |
133 virtual ~MDnsSocketFactory() {} | 130 virtual ~MDnsSocketFactory() {} |
134 virtual void CreateSockets(ScopedVector<DatagramServerSocket>* sockets) = 0; | 131 virtual void CreateSockets( |
132 std::vector<scoped_ptr<DatagramServerSocket>>* sockets) = 0; | |
mmenke
2015/11/24 17:39:33
include scoped_ptr (Yea, should have been included
| |
135 | 133 |
136 static scoped_ptr<MDnsSocketFactory> CreateDefault(); | 134 static scoped_ptr<MDnsSocketFactory> CreateDefault(); |
137 }; | 135 }; |
138 | 136 |
139 // Listens for Multicast DNS on the local network. You can access information | 137 // Listens for Multicast DNS on the local network. You can access information |
140 // regarding multicast DNS either by creating an |MDnsListener| to be notified | 138 // regarding multicast DNS either by creating an |MDnsListener| to be notified |
141 // of new records, or by creating an |MDnsTransaction| to look up the value of a | 139 // of new records, or by creating an |MDnsTransaction| to look up the value of a |
142 // specific records. When all listeners and active transactions are destroyed, | 140 // specific records. When all listeners and active transactions are destroyed, |
143 // the client stops listening on the network and destroys the cache. | 141 // the client stops listening on the network and destroys the cache. |
144 class NET_EXPORT MDnsClient { | 142 class NET_EXPORT MDnsClient { |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
181 // Create sockets, binds socket to MDns endpoint, and sets multicast interface | 179 // Create sockets, binds socket to MDns endpoint, and sets multicast interface |
182 // and joins multicast group on for |interface_index|. | 180 // and joins multicast group on for |interface_index|. |
183 // Returns NULL if failed. | 181 // Returns NULL if failed. |
184 NET_EXPORT scoped_ptr<DatagramServerSocket> CreateAndBindMDnsSocket( | 182 NET_EXPORT scoped_ptr<DatagramServerSocket> CreateAndBindMDnsSocket( |
185 AddressFamily address_family, | 183 AddressFamily address_family, |
186 uint32 interface_index); | 184 uint32 interface_index); |
187 | 185 |
188 } // namespace net | 186 } // namespace net |
189 | 187 |
190 #endif // NET_DNS_MDNS_CLIENT_H_ | 188 #endif // NET_DNS_MDNS_CLIENT_H_ |
OLD | NEW |