virtual void DiscoverNewServices(bool force_update) OVERRIDE;
+ virtual void SetActivelyRefreshServices(
+ bool actively_refresh_services) OVERRIDE;
+
virtual std::string GetServiceType() const OVERRIDE;
virtual void OnRecordUpdate(net::MDnsListener::UpdateType update,
net::MDnsClient* mdns_client);
~ServiceListeners();
bool Start();
+ void SetActiveRefresh(bool auto_update);
void set_update_pending(bool update_pending) {
update_pending_ = update_pending;
}
bool update_pending() { return update_pending_; }
+
+ void set_has_ptr(bool has_ptr) {
+ has_ptr_ = has_ptr;
+ }
+
+ void set_has_srv(bool has_srv);
+
+ bool has_ptr_or_srv() { return has_ptr_ || has_srv_; }
+
private:
+ void OnSRVRecord(net::MDnsTransaction::Result result,
+ const net::RecordParsed* record);
+
+ void DoQuerySRV();
+
scoped_ptr<net::MDnsListener> srv_listener_;
scoped_ptr<net::MDnsListener> txt_listener_;
+ scoped_ptr<net::MDnsTransaction> srv_transaction_;
+
+ std::string service_name_;
+ net::MDnsClient* mdns_client_;
bool update_pending_;
+
+ bool has_ptr_;
+ bool has_srv_;
};
typedef std::map<std::string, linked_ptr<ServiceListeners> >
void ReadCachedServices();
void AddService(const std::string& service);
- void RemoveService(const std::string& service);
+ void RemovePTR(const std::string& service);
+ void RemoveSRV(const std::string& service);
+ void AddSRV(const std::string& service);
bool CreateTransaction(bool active, bool alert_existing_services,
bool force_refresh,
scoped_ptr<net::MDnsTransaction>* transaction);
ServiceWatcher::UpdatedCallback callback_;
bool started_;
+ bool actively_refresh_services_;
net::MDnsClient* mdns_client_;