libupnpp 0.16.0
A C++ wrapper for the Portable UPnP reference library
discovery.hxx
1/* Copyright (C) 2006-2016 J.F.Dockes
2 *
3 * This library is free software; you can redistribute it and/or
4 * modify it under the terms of the GNU Lesser General Public
5 * License as published by the Free Software Foundation; either
6 * version 2.1 of the License, or (at your option) any later version.
7 *
8 * This library is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public
14 * License along with this library; if not, write to the Free Software
15 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
16 * 02110-1301 USA
17 */
18#ifndef _UPNPPDISC_H_X_INCLUDED_
19#define _UPNPPDISC_H_X_INCLUDED_
20
21#include <time.h>
22
23#include <string>
24#include <functional>
25#include <unordered_map>
26
27#include "libupnpp/upnppexports.hxx"
28
29namespace UPnPClient {
30class UPnPDeviceDesc;
31}
32namespace UPnPClient {
33class UPnPServiceDesc;
34}
35
36namespace UPnPClient {
37
62class UPNPP_API UPnPDeviceDirectory {
63public:
65 UPnPDeviceDirectory& operator=(const UPnPDeviceDirectory&) = delete;
66
71 static UPnPDeviceDirectory *getTheDir(time_t search_window = 2);
72
74 static void terminate();
75
77 typedef std::function<bool (const UPnPDeviceDesc&, const UPnPServiceDesc&)> Visitor;
78
81 bool traverse(Visitor);
82
85 time_t getRemainingDelayMs();
88 time_t getRemainingDelay();
89
94 static unsigned int addCallback(Visitor v);
96 static void delCallback(unsigned int idx);
97
100 static unsigned int addLostCallback(Visitor v);
102 static void delLostCallback(unsigned int idx);
103
114 bool getDevByFName(const std::string& fname, UPnPDeviceDesc& ddesc);
115
124 bool getDevByUDN(const std::string& udn, UPnPDeviceDesc& ddesc);
125
133 bool getDescriptionDocuments(
134 const std::string &uidOrFriendly, std::string& deviceXML,
135 std::unordered_map<std::string, std::string>& srvsXML);
136
144 bool uniSearch(const std::string& url);
145
147 bool ok();
148
150 const std::string getReason();
151
152private:
153 UPNPP_LOCAL UPnPDeviceDirectory(time_t search_window);
154};
155
156} // namespace UPnPClient
157
158#endif /* _UPNPPDISC_H_X_INCLUDED_ */
Data holder for a UPnP device, parsed from the XML description obtained during discovery.
Definition description.hxx:139
Manage UPnP discovery and maintain a directory of active devices.
Definition discovery.hxx:62
std::function< bool(const UPnPDeviceDesc &, const UPnPServiceDesc &)> Visitor
Type of user callback functions used for reporting devices and services.
Definition discovery.hxx:77
Data holder for a UPnP service, parsed from the device XML description.
Definition description.hxx:46
UPnP Description phase: interpreting the device description which we downloaded from the URL obtained...
Definition avlastchg.cxx:28