summaryrefslogtreecommitdiffstats
blob: c0788e6ac65caf890a21101b96b483bf2c402989 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#pragma once

#include <boost/shared_ptr.hpp>
#include <boost/optional.hpp>
#include <map>
#include <vector>

#include "Swiften/Base/String.h"
#include "Swiften/LinkLocal/DNSSDService.h"
#include "Swiften/LinkLocal/LinkLocalService.h"

namespace Swift {
	class HostAddress;

	class LinkLocalServiceBrowser {
		public:
			LinkLocalServiceBrowser(boost::shared_ptr<DNSSDService> service);

			boost::signal<void (const LinkLocalServiceID&)> onServiceAdded;
			boost::signal<void (const LinkLocalServiceID&)> onServiceChanged;

		private:
			void handleServiceAdded(const LinkLocalServiceID&);
			void handleServiceRemoved(const LinkLocalServiceID&);
			void handleServiceResolved(const LinkLocalServiceID& service, const DNSSDService::ResolveResult& result);

		private:
			boost::shared_ptr<DNSSDService> dnsSDService;
			typedef std::map<LinkLocalServiceID, DNSSDService::ResolveResult> ServiceMap;
			ServiceMap services;
	};
}