--- a/libupnpp/device/device.cxx
+++ b/libupnpp/device/device.cxx
@@ -209,6 +209,21 @@
o->devices.erase(it);
}
+bool UpnpDevice::ipv4(string *host, unsigned short *port) const
+{
+ char *hst = UpnpGetServerIpAddress();
+ if (hst == 0) {
+ return false;
+ }
+ if (port) {
+ *port = UpnpGetServerPort();
+ }
+ if (host) {
+ *host = string(hst);
+ }
+ return true;
+}
+
bool UpnpDevice::Internal::start()
{
// Start up the web server for sending out description files. This also
@@ -231,6 +246,7 @@
return true;
}
+
// Main libupnp callback: use the device id and call the right device
int UpnpDevice::InternalStatic::sCallBack(Upnp_EventType et, void* evp,
void*)
@@ -621,6 +637,15 @@
dev->addService(this, sid);
}
+UpnpDevice *UpnpService::getDevice()
+{
+ if (m) {
+ return m->dev;
+ } else {
+ return nullptr;
+ }
+}
+
UpnpService::~UpnpService()
{
if (m) {