libupnpp 0.16.0
A C++ wrapper for the Portable UPnP reference library
upnpplib.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 _LIBUPNP_H_X_INCLUDED_
19#define _LIBUPNP_H_X_INCLUDED_
20
21#include <map>
22#include <string>
23
24#include "upnppexports.hxx"
25
27#define LIBUPNPP_VERSION_MAJOR 1
28#define LIBUPNPP_VERSION_MINOR 0
29#define LIBUPNPP_VERSION_REVISION 3
31#define LIBUPNPP_AT_LEAST(A,B,C) \
32 (LIBUPNPP_VERSION_MAJOR > (A) || \
33 (LIBUPNPP_VERSION_MAJOR == (A) && \
34 (LIBUPNPP_VERSION_MINOR > (B) || \
35 (LIBUPNPP_VERSION_MINOR == (B) && LIBUPNPP_VERSION_REVISION >= (C)))))
36
37// Let clients avoid including upnp.h if they don't need it for other reasons
38#ifndef UPNP_E_SUCCESS
39#define UPNP_E_SUCCESS 0
40#endif
41
42// Feature test defines to help client programs, esp. for features
43// added without breaking api and avi
44
45// upnp/av connection manager control api
46#define LIBUPNPP_HAS_UPNPAVCONMAN 1
47
48namespace UPnPP {
49
56class UPNPP_API LibUPnP {
57public:
58 ~LibUPnP();
59
60 LibUPnP(const LibUPnP&) = delete;
61 LibUPnP& operator=(const LibUPnP&) = delete;
62
64 enum InitFlags {
65 UPNPPINIT_FLAG_NONE = 0,
67 UPNPPINIT_FLAG_NOIPV6 = 0x1,
69 UPNPPINIT_FLAG_SERVERONLY = 0x2,
77 UPNPPINIT_FLAG_RESANITIZE_URLS = 0x4,
78 };
79
116
124 static bool init(unsigned int flags, ...);
125
148 static LibUPnP* getLibUPnP(bool serveronly = false, std::string* hwaddr = 0,
149 const std::string ifname = std::string(),
150 const std::string ip = std::string(),
151 unsigned short port = 0);
152
154 std::string host();
156 std::string port();
158 std::string hwaddr();
159
166 bool setWebServerDocumentRoot(const std::string& rootpath);
167
175 void setMaxContentLength(int bytes);
176
178 bool ok() const;
179
181 static std::string versionString();
182
185 enum LogLevel {LogLevelNone, LogLevelError, LogLevelInfo, LogLevelDebug, LogLevelAll};
186
194 static bool setLogFileName(const std::string& fn, LogLevel level = LogLevelError);
195
200 static bool setLogLevel(LogLevel level);
201
203 static int getInitError();
204
211 static std::string makeDevUUID(const std::string& name, const std::string& hw);
212
214 static std::string errAsString(const std::string& who, int code);
215
216 class UPNPP_LOCAL Internal;
217 Internal *m;
218
219private:
220 LibUPnP();
221};
222
223} // namespace UPnPP
224
225#endif /* _LIBUPNP.H_X_INCLUDED_ */
Our link to libupnp.
Definition upnpplib.hxx:56
InitOption
Options for the initialisation call.
Definition upnpplib.hxx:82
@ UPNPPINIT_OPTION_IPV4
Use single IPV4 address.
Definition upnpplib.hxx:93
@ UPNPPINIT_OPTION_SUBSOPS_TIMEOUTMS
Control: HTTP timeout for subscription/unsubscriptions connections to the device.
Definition upnpplib.hxx:107
@ UPNPPINIT_OPTION_CLIENT_PRODUCT
Control: product name to set in user-agent strings.
Definition upnpplib.hxx:100
@ UPNPPINIT_OPTION_SUBSCRIPTION_TIMEOUT
Control: subscription timeout in seconds.
Definition upnpplib.hxx:97
@ UPNPPINIT_OPTION_IFNAMES
Names of the interfaces to use.
Definition upnpplib.hxx:89
@ UPNPPINIT_OPTION_PORT
IP Port to use.
Definition upnpplib.hxx:95
@ UPNPPINIT_OPTION_CLIENT_VERSION
Control: product version to set in user-agent strings.
Definition upnpplib.hxx:103
@ UPNPPINIT_OPTION_RESANITIZED_CHARS
Control: characters that we should further url-escape when found in URLs out of a content directory.
Definition upnpplib.hxx:111
@ UPNPPINIT_OPTION_BOOTID
Device: UPnP 1.1 BOOTINIT.UPNP.ORG value.
Definition upnpplib.hxx:114
LogLevel
libnpupnp (pupnp) logging: this is distinct from libupnpp logging
Definition upnpplib.hxx:185
InitFlags
Configuration flags for the initialisation call.
Definition upnpplib.hxx:64
Deal with data for the SOAP action protocol.
Definition base64.cxx:26