libupnpp
0.16.0
A C++ wrapper for the Portable UPnP reference library
|
Our link to libupnp. More...
#include <upnpplib.hxx>
Classes | |
class | Internal |
Public Types | |
enum | InitFlags { UPNPPINIT_FLAG_NONE = 0, UPNPPINIT_FLAG_NOIPV6 = 1, UPNPPINIT_FLAG_SERVERONLY = 2 } |
Configuration flags for the initialisation call. More... | |
enum | InitOption { UPNPPINIT_OPTION_END = 0, UPNPPINIT_OPTION_IFNAMES, UPNPPINIT_OPTION_IPV4, UPNPPINIT_OPTION_PORT, UPNPPINIT_OPTION_SUBSCRIPTION_TIMEOUT, UPNPPINIT_OPTION_CLIENT_PRODUCT, UPNPPINIT_OPTION_CLIENT_VERSION } |
Options for the initialisation call. More... | |
enum | LogLevel { LogLevelNone, LogLevelError, LogLevelInfo, LogLevelDebug, LogLevelAll } |
libnpupnp (pupnp) logging: this is distinct from libupnpp logging More... | |
Public Member Functions | |
std::string | host () |
Return the IP v4 address as dotted notation. | |
std::string | hwaddr () |
Return one ethernet address. | |
void | setMaxContentLength (int bytes) |
Set max library buffer size for reading content from servers. More... | |
bool | ok () const |
Check state after initialization. | |
Static Public Member Functions | |
static LibUPnP * | getLibUPnP (bool serveronly=false, std::string *hwaddr=0, const std::string ifname=std::string(), const std::string ip=std::string(), unsigned short port=0) |
Retrieve the singleton LibUPnP object. More... | |
static bool | init (unsigned int flags,...) |
Initialize the library. More... | |
static std::string | versionString () |
Returns something like "libupnpp 0.14.0 libupnp x.y.z". | |
static bool | setLogFileName (const std::string &fn, LogLevel level=LogLevelError) |
Set libnpupnp log file name and activate/deactivate logging. More... | |
static bool | setLogLevel (LogLevel level) |
Set libnpupnp log level. More... | |
static int | getInitError () |
Retrieve init error if state not ok. | |
static std::string | makeDevUUID (const std::string &name, const std::string &hw) |
Build a unique stable UUID. More... | |
static std::string | errAsString (const std::string &who, int code) |
Translate libupnp integer error code (UPNP_E_XXX) to string. | |
Public Attributes | |
class UPNPP_LOCAL | Internal |
Internal * | m |
Our link to libupnp.
Initialize and keep the handle around.
Not all applications will need to use this. The initialization call will be performed internally as needed, you only need to call it if you need to set specific parameters.
Options for the initialisation call.
Each option argument may be followed by specific parameters.
libnpupnp (pupnp) logging: this is distinct from libupnpp logging
libnpupnp log levels
|
static |
Retrieve the singleton LibUPnP object.
Using this call with arguments is deprecated. Call init() (creates the lib) then getLibUPnP() without arguments instead.
This initializes libupnp, possibly setting an address and port, possibly registering a client if serveronly is false.
serveronly | no client init |
|
static |
Initialize the library.
On success you will then call getLibUPnP() to access the object instance.
flags | A bitfield of InitFlags values. |
... | A list of InitOption and values, ended by UPNPPINIT_OPTION_END. |
|
static |
Build a unique stable UUID.
This uses a hash of the input name (e.g.: friendlyName), and the Ethernet address.
name | device "friendly name" |
hw | device ethernet address (as 12 ascii hexadecimal bytes) |
|
static |
Set libnpupnp log file name and activate/deactivate logging.
Do not use the same file as the one used for libupnpp logging.
fn | file name to use. Use an empty string log to stderr. LogLevelNone to turn off. |
|
static |
Set libnpupnp log level.
void UPnPP::LibUPnP::setMaxContentLength | ( | int | bytes | ) |
Set max library buffer size for reading content from servers.
Just calls libupnp UpnpSetMaxContentLength(). This defines the maximum amount of data that Soap calls will accept from the remote. The libupnp default is very low (16KB), but libupnpp sets the value to 2MB during initialization. You can reset the value to your own choice by using this method.