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 namespace net { | 17 namespace net { |
18 | 18 |
19 class DatagramServerSocket; | 19 class DatagramServerSocket; |
20 class RecordParsed; | 20 class RecordParsed; |
21 | 21 |
22 // Represents a one-time record lookup. A transaction takes one | 22 // Represents a one-time record lookup. A transaction takes one |
23 // associated callback (see |MDnsClient::CreateTransaction|) and calls it | 23 // associated callback (see |MDnsClient::CreateTransaction|) and calls it |
24 // 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 |
25 // 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 |
26 // creation flags, see MDnsTransactionFlags). Network-based transactions will | 26 // creation flags, see MDnsTransactionFlags). Network-based transactions will |
27 // time out after a reasonable number of seconds. | 27 // time out after a reasonable number of seconds. |
28 class NET_EXPORT MDnsTransaction { | 28 class NET_EXPORT MDnsTransaction { |
29 public: | 29 public: |
30 // Used to signify what type of result the transaction has recieved. | 30 // Used to signify what type of result the transaction has received. |
31 enum Result { | 31 enum Result { |
32 // Passed whenever a record is found. | 32 // Passed whenever a record is found. |
33 RESULT_RECORD, | 33 RESULT_RECORD, |
34 // The transaction is done. Applies to non-single-valued transactions. Is | 34 // The transaction is done. Applies to non-single-valued transactions. Is |
35 // called when the transaction has finished (this is the last call to the | 35 // called when the transaction has finished (this is the last call to the |
36 // callback). | 36 // callback). |
37 RESULT_DONE, | 37 RESULT_DONE, |
38 // No results have been found. Applies to single-valued transactions. Is | 38 // No results have been found. Applies to single-valued transactions. Is |
39 // called when the transaction has finished without finding any results. | 39 // called when the transaction has finished without finding any results. |
40 // For transactions that use the network, this happens when a timeout | 40 // For transactions that use the network, this happens when a timeout |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 // Create sockets, binds socket to MDns endpoint, and sets multicast interface | 178 // Create sockets, binds socket to MDns endpoint, and sets multicast interface |
179 // and joins multicast group on for |interface_index|. | 179 // and joins multicast group on for |interface_index|. |
180 // Returns NULL if failed. | 180 // Returns NULL if failed. |
181 NET_EXPORT scoped_ptr<DatagramServerSocket> CreateAndBindMDnsSocket( | 181 NET_EXPORT scoped_ptr<DatagramServerSocket> CreateAndBindMDnsSocket( |
182 AddressFamily address_family, | 182 AddressFamily address_family, |
183 uint32 interface_index); | 183 uint32 interface_index); |
184 | 184 |
185 } // namespace net | 185 } // namespace net |
186 | 186 |
187 #endif // NET_DNS_MDNS_CLIENT_H_ | 187 #endif // NET_DNS_MDNS_CLIENT_H_ |
OLD | NEW |