2017-02-16 16:29:55 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace NoccyLabs\UPnP\SSDP;
|
|
|
|
|
|
|
|
/*
|
|
|
|
<serviceType>urn:schemas-upnp-org:service:Layer3Forwarding:1</serviceType>
|
|
|
|
<serviceId>urn:upnp-org:serviceId:L3Forwarding1</serviceId>
|
|
|
|
<SCPDURL>/L3F.xml</SCPDURL>
|
|
|
|
<controlURL>/ctl/L3F</controlURL>
|
|
|
|
<eventSubURL>/evt/L3F</eventSubURL>
|
|
|
|
*/
|
|
|
|
|
|
|
|
use SimpleXMLElement;
|
|
|
|
|
|
|
|
class Service
|
|
|
|
{
|
|
|
|
protected $serviceType;
|
|
|
|
|
|
|
|
protected $serviceId;
|
|
|
|
|
|
|
|
protected $scpdUrl;
|
|
|
|
|
|
|
|
protected $controlUrl;
|
|
|
|
|
|
|
|
protected $eventSubUrl;
|
|
|
|
|
|
|
|
public function __construct(SimpleXMLElement $spec)
|
|
|
|
{
|
|
|
|
|
|
|
|
$this->serviceType = (string)$spec->serviceType;
|
|
|
|
$this->serviceId = (string)$spec->serviceId;
|
|
|
|
$this->scpdUrl = (string)$spec->SCPDURL;
|
|
|
|
$this->controlUrl = (string)$spec->controlURL;
|
|
|
|
$this->eventSubUrl = (string)$spec->eventSubURL;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2017-02-16 17:40:02 +01:00
|
|
|
public function getServiceType()
|
|
|
|
{
|
|
|
|
return $this->serviceType;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getServiceId()
|
|
|
|
{
|
|
|
|
return $this->serviceId;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getScpdUrl()
|
|
|
|
{
|
|
|
|
return $this->scpdUrl;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getControlUrl()
|
|
|
|
{
|
|
|
|
return $this->controlUrl;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getEventSubUrl()
|
|
|
|
{
|
|
|
|
return $this->eventSubUrl;
|
|
|
|
}
|
|
|
|
|
2017-02-16 16:29:55 +01:00
|
|
|
public function __toString()
|
|
|
|
{
|
|
|
|
return sprintf("Service: %s [%s]\nControl URL: %s\nEventSub URL: %s\nSCPD URL: %s\n",
|
|
|
|
$this->serviceId,
|
|
|
|
$this->serviceType,
|
|
|
|
$this->controlUrl,
|
|
|
|
$this->eventSubUrl,
|
|
|
|
$this->scpdUrl
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|