kodi
Public Member Functions | Static Public Attributes | List of all members
UPNP::CUPnPServer Class Reference
Inheritance diagram for UPNP::CUPnPServer:
Inheritance graph
[legend]
Collaboration diagram for UPNP::CUPnPServer:
Collaboration graph
[legend]

Public Member Functions

 CUPnPServer (const char *friendly_name, const char *uuid=NULL, int port=0)
 
void Announce (ANNOUNCEMENT::AnnouncementFlag flag, const std::string &sender, const std::string &message, const CVariant &data) override
 
NPT_Result OnBrowseMetadata (PLT_ActionReference &action, const char *object_id, const char *filter, NPT_UInt32 starting_index, NPT_UInt32 requested_count, const char *sort_criteria, const PLT_HttpRequestContext &context) override
 
NPT_Result OnBrowseDirectChildren (PLT_ActionReference &action, const char *object_id, const char *filter, NPT_UInt32 starting_index, NPT_UInt32 requested_count, const char *sort_criteria, const PLT_HttpRequestContext &context) override
 
NPT_Result OnSearchContainer (PLT_ActionReference &action, const char *container_id, const char *search_criteria, const char *filter, NPT_UInt32 starting_index, NPT_UInt32 requested_count, const char *sort_criteria, const PLT_HttpRequestContext &context) override
 
NPT_Result OnUpdateObject (PLT_ActionReference &action, const char *object_id, NPT_Map< NPT_String, NPT_String > &current_vals, NPT_Map< NPT_String, NPT_String > &new_vals, const PLT_HttpRequestContext &context) override
 
NPT_Result ServeFile (const NPT_HttpRequest &request, const NPT_HttpRequestContext &context, NPT_HttpResponse &response, const NPT_String &file_path) override
 
NPT_Result ProcessGetSCPD (PLT_Service *service, NPT_HttpRequest &request, const NPT_HttpRequestContext &context, NPT_HttpResponse &response) override
 This method is called when a control point is requesting a service SCPD. More...
 
NPT_Result SetupServices () override
 Required method for setting up UPnP services of device host (and any embedded). More...
 
NPT_Result SetupIcons () override
 Default implementation for registering device icon resources. More...
 
NPT_String BuildSafeResourceUri (const NPT_HttpUrl &rooturi, const char *host, const char *file_path)
 
void AddSafeResourceUri (PLT_MediaObject *object, const NPT_HttpUrl &rooturi, const NPT_List< NPT_IpAddress > &ips, const char *file_path, const NPT_String &info)
 
NPT_Result AddSubtitleUriForSecResponse (const NPT_String &movie_md5, const NPT_String &subtitle_uri)
 
- Public Member Functions inherited from PLT_MediaConnect
 PLT_MediaConnect (const char *friendly_name, bool add_hostname=true, const char *udn=NULL, NPT_UInt16 port=0, bool port_rebind=false)
 
- Public Member Functions inherited from PLT_MediaServer
 PLT_MediaServer (const char *friendly_name, bool show_ip=false, const char *uuid=NULL, NPT_UInt16 port=0, bool port_rebind=false)
 
virtual void SetDelegate (PLT_MediaServerDelegate *delegate)
 
PLT_MediaServerDelegateGetDelegate ()
 
virtual void UpdateSystemUpdateID (NPT_UInt32 update)
 
virtual void UpdateContainerUpdateID (const char *id, NPT_UInt32 update)
 
- Public Member Functions inherited from PLT_DeviceHost
 PLT_DeviceHost (const char *description_path="/", const char *uuid="", const char *device_type="", const char *friendly_name="", bool show_ip=false, NPT_UInt16 port=0, bool port_rebind=false)
 Creates a new instance of UPnP Device Host. More...
 
virtual void SetExtraBroadcast (bool broadcast)
 
virtual void SetByeByeFirst (bool bye_bye_first)
 When a UPnP device comes up, the specifications require that a SSDP bye-bye sequence is sent to force the removal of the device in case it wasn't sent properly during the last shutdown. More...
 
virtual NPT_UInt16 GetPort ()
 Returns the port used by the internal HTTP server for all incoming requests. More...
 
NPT_Result SetLeaseTime (NPT_TimeInterval lease_time)
 Sets the lease time. More...
 
virtual NPT_Result AddIcon (const PLT_DeviceIcon &icon, const char *fileroot, const char *urlroot="/")
 Add UPnP icon information to serve from file system. More...
 
virtual NPT_Result AddIcon (const PLT_DeviceIcon &icon, const void *data, NPT_Size size, bool copy=true)
 Add UPnP icon information to serve using static image. More...
 
- Public Member Functions inherited from PLT_DeviceData
 PLT_DeviceData (NPT_HttpUrl description_url=NPT_HttpUrl(NULL, 0, "/description.xml"), const char *uuid="", NPT_TimeInterval lease_time= *PLT_Constants::GetInstance().GetDefaultDeviceLease(), const char *device_type="", const char *friendly_name="")
 
virtual NPT_Result GetDescription (NPT_String &desc)
 
virtual NPT_String GetDescriptionUrl (const char *ip_address=NULL)
 
virtual NPT_HttpUrl GetURLBase ()
 
virtual NPT_HttpUrl NormalizeURL (const NPT_String &url)
 
virtual NPT_Result GetDescription (NPT_XmlElementNode *parent, NPT_XmlElementNode **device=NULL)
 
virtual NPT_String GetIconUrl (const char *mimetype=NULL, NPT_Int32 maxsize=0, NPT_Int32 maxdepth=0)
 
bool IsRoot ()
 
const NPT_TimeIntervalGetLeaseTime () const
 
const NPT_StringGetUUID () const
 
const NPT_StringGetFriendlyName () const
 
const NPT_StringGetType () const
 
const NPT_StringGetModelDescription () const
 
const NPT_StringGetParentUUID () const
 
const NPT_IpAddressGetLocalIP () const
 
const NPT_Array< PLT_Service * > & GetServices () const
 
const NPT_Array< PLT_DeviceDataReference > & GetEmbeddedDevices () const
 
NPT_Result FindEmbeddedDevice (const char *uuid, PLT_DeviceDataReference &device)
 
NPT_Result FindEmbeddedDeviceByType (const char *type, PLT_DeviceDataReference &device)
 
NPT_Result FindServiceById (const char *id, PLT_Service *&service)
 
NPT_Result FindServiceByType (const char *type, PLT_Service *&service)
 
NPT_Result FindServiceByName (const char *name, PLT_Service *&service)
 
NPT_Result FindServiceBySCPDURL (const char *url, PLT_Service *&service, bool recursive=false)
 
NPT_Result FindServiceByControlURL (const char *url, PLT_Service *&service, bool recursive=false)
 
NPT_Result FindServiceByEventSubURL (const char *url, PLT_Service *&service, bool recursive=false)
 
NPT_Result AddEmbeddedDevice (PLT_DeviceDataReference &device)
 
NPT_Result RemoveEmbeddedDevice (PLT_DeviceDataReference &device)
 
NPT_Result AddService (PLT_Service *service)
 
NPT_Result RemoveService (PLT_Service *service)
 
void SetBootId (NPT_UInt32 bootId)
 
void SetNextBootId (NPT_UInt32 nextBootId)
 
NPT_UInt32 GenerateNextBootId ()
 
 operator const char * ()
 
- Public Member Functions inherited from NPT_HttpRequestHandler
virtual NPT_Result SendResponseBody (const NPT_HttpRequestContext &context, NPT_HttpResponse &response, NPT_OutputStream &output)
 Override this method if you want to write the body yourself. More...
 
virtual void Completed (NPT_Result)
 A notification method called by the server upon completing the processing of a request.
 
- Public Member Functions inherited from PLT_FileMediaConnectDelegate
 PLT_FileMediaConnectDelegate (const char *url_root, const char *file_root)
 
NPT_Result GetFilePath (const char *object_id, NPT_String &filepath) override
 
- Public Member Functions inherited from PLT_FileMediaServerDelegate
 PLT_FileMediaServerDelegate (const char *url_root, const char *file_root, bool use_cache=false)
 

Static Public Attributes

static NPT_UInt32 m_MaxReturnedItems = 0
 

Additional Inherited Members

- Public Types inherited from PLT_MediaServer
enum  BrowseFlags { BROWSEMETADATA, BROWSEDIRECTCHILDREN }
 
- Static Public Member Functions inherited from PLT_MediaConnect
static NPT_Result GetMappedObjectId (const char *object_id, NPT_String &mapped_object_id)
 
- Static Public Member Functions inherited from PLT_MediaServer
static NPT_Result ParseBrowseFlag (const char *str, BrowseFlags &flag)
 
static NPT_Result ParseSort (const NPT_String &sort, NPT_List< NPT_String > &list)
 
static NPT_Result ParseTagList (const NPT_String &updates, NPT_Map< NPT_String, NPT_String > &tags)
 
- Static Public Member Functions inherited from PLT_FileMediaServerDelegate
static NPT_String BuildSafeResourceUri (const NPT_HttpUrl &base_uri, const char *host, const char *file_path)
 
- Public Attributes inherited from PLT_DeviceData
NPT_String m_Manufacturer
 
NPT_String m_ManufacturerURL
 
NPT_String m_ModelDescription
 
NPT_String m_ModelName
 
NPT_String m_ModelNumber
 
NPT_String m_ModelURL
 
NPT_String m_SerialNumber
 
NPT_String m_UPC
 
NPT_String m_PresentationURL
 
NPT_String m_DlnaDoc
 
NPT_String m_DlnaCap
 
NPT_String m_AggregationFlags
 
- Protected Member Functions inherited from PLT_MediaConnect
NPT_Result OnAction (PLT_ActionReference &action, const PLT_HttpRequestContext &context) override
 This mehod is called when an action performed by a control point has been received and needs to be answered. More...
 
NPT_Result ProcessGetDescription (NPT_HttpRequest &request, const NPT_HttpRequestContext &context, NPT_HttpResponse &response) override
 This method is called when a control point is requesting the device description. More...
 
virtual NPT_Result OnIsAuthorized (PLT_ActionReference &action)
 
virtual NPT_Result OnRegisterDevice (PLT_ActionReference &action)
 
virtual NPT_Result OnIsValidated (PLT_ActionReference &action)
 
- Protected Member Functions inherited from PLT_MediaServer
NPT_Result OnAction (PLT_ActionReference &action, const PLT_HttpRequestContext &context) override
 This mehod is called when an action performed by a control point has been received and needs to be answered. More...
 
NPT_Result ProcessHttpGetRequest (NPT_HttpRequest &request, const NPT_HttpRequestContext &context, NPT_HttpResponse &response) override
 This method is called when a "GET" request for a resource other than the device description, SCPD, or icons has been received. More...
 
virtual NPT_Result OnGetCurrentConnectionIDs (PLT_ActionReference &action, const PLT_HttpRequestContext &context)
 
virtual NPT_Result OnGetProtocolInfo (PLT_ActionReference &action, const PLT_HttpRequestContext &context)
 
virtual NPT_Result OnGetCurrentConnectionInfo (PLT_ActionReference &action, const PLT_HttpRequestContext &context)
 
virtual NPT_Result OnGetSortCapabilities (PLT_ActionReference &action, const PLT_HttpRequestContext &context)
 
virtual NPT_Result OnGetSearchCapabilities (PLT_ActionReference &action, const PLT_HttpRequestContext &context)
 
virtual NPT_Result OnGetSystemUpdateID (PLT_ActionReference &action, const PLT_HttpRequestContext &context)
 
virtual NPT_Result OnBrowse (PLT_ActionReference &action, const PLT_HttpRequestContext &context)
 
virtual NPT_Result OnSearch (PLT_ActionReference &action, const PLT_HttpRequestContext &context)
 
virtual NPT_Result OnUpdate (PLT_ActionReference &action, const PLT_HttpRequestContext &context)
 
- Protected Member Functions inherited from PLT_DeviceHost
NPT_Result SetupResponse (NPT_HttpRequest &request, const NPT_HttpRequestContext &context, NPT_HttpResponse &response) override
 NPT_HttpRequestHandler method for setting up the response of an incoming HTTP request. More...
 
NPT_Result Announce (NPT_HttpRequest &request, NPT_UdpSocket &socket, PLT_SsdpAnnounceType type)
 Called during SSDP announce. More...
 
NPT_Result OnSsdpPacket (const NPT_HttpRequest &request, const NPT_HttpRequestContext &context) override
 PLT_SsdpPacketListener method called when a M-SEARCH SSDP packet is received. More...
 
virtual NPT_Result SendSsdpSearchResponse (NPT_HttpResponse &response, NPT_UdpSocket &socket, const char *st, const NPT_SocketAddress *addr=NULL)
 Called by PLT_SsdpDeviceSearchResponseTask when responding to a M-SEARCH SSDP request. More...
 
virtual NPT_Result SetupDevice ()
 Default implementation for setting up device host. More...
 
virtual NPT_Result Start (PLT_SsdpListenTask *task)
 Called by PLT_TaskManager when the device is started. More...
 
virtual NPT_Result Stop (PLT_SsdpListenTask *task)
 Called by PLT_TaskManager when the device is stoped. More...
 
virtual NPT_Result ProcessHttpPostRequest (NPT_HttpRequest &request, const NPT_HttpRequestContext &context, NPT_HttpResponse &response)
 This method is called when a "POST" request has been received. More...
 
virtual NPT_Result ProcessHttpSubscriberRequest (NPT_HttpRequest &request, const NPT_HttpRequestContext &context, NPT_HttpResponse &response)
 This method is called when a request from a subscriber has been received. More...
 
- Protected Member Functions inherited from PLT_DeviceData
virtual void Cleanup ()
 
virtual NPT_Result OnAddExtraInfo (NPT_XmlElementNode *)
 
- Protected Member Functions inherited from PLT_FileMediaServerDelegate
NPT_Result ProcessFileRequest (NPT_HttpRequest &request, const NPT_HttpRequestContext &context, NPT_HttpResponse &response) override
 
virtual NPT_Result ExtractResourcePath (const NPT_HttpUrl &url, NPT_String &file_path)
 
virtual NPT_String BuildResourceUri (const NPT_HttpUrl &base_uri, const char *host, const char *file_path)
 
virtual bool ProcessFile (const NPT_String &, const char *filter=NULL)
 
virtual PLT_MediaObjectBuildFromFilePath (const NPT_String &filepath, const PLT_HttpRequestContext &context, bool with_count=true, bool keep_extension_in_title=false, bool allip=false)
 
- Static Protected Member Functions inherited from PLT_DeviceHost
static NPT_Result Announce (PLT_DeviceData *device, NPT_HttpRequest &request, NPT_UdpSocket &socket, PLT_SsdpAnnounceType type)
 Static method similar to Announce. More...
 
static NPT_Result SendSsdpSearchResponse (PLT_DeviceData *device, NPT_HttpResponse &response, NPT_UdpSocket &socket, const char *st, const NPT_SocketAddress *addr=NULL)
 Static method similar to SendSsdpSearchResponse. More...
 
- Protected Attributes inherited from PLT_MediaConnect
NPT_Mutex m_Lock
 
bool m_AddHostname
 
- Protected Attributes inherited from PLT_DeviceHost
PLT_TaskManagerReference m_TaskManager
 
PLT_HttpServerReference m_HttpServer
 
bool m_ExtraBroascast
 
NPT_UInt16 m_Port
 
bool m_PortRebind
 
bool m_ByeByeFirst
 
bool m_Started
 
- Protected Attributes inherited from PLT_DeviceData
NPT_String m_ParentUUID
 
NPT_String m_UUID
 
NPT_HttpUrl m_URLDescription
 
NPT_HttpUrl m_URLBase
 
NPT_String m_DeviceType
 
NPT_String m_FriendlyName
 
NPT_TimeInterval m_LeaseTime
 
NPT_TimeStamp m_LeaseTimeLastUpdate
 
NPT_Array< PLT_Service * > m_Services
 
NPT_Array< PLT_DeviceDataReferencem_EmbeddedDevices
 
NPT_Array< PLT_DeviceIconm_Icons
 
NPT_IpAddress m_LocalIfaceIp
 
NPT_String m_Representation
 
- Protected Attributes inherited from PLT_FileMediaServerDelegate
NPT_String m_UrlRoot
 
NPT_String m_FileRoot
 
bool m_FilterUnknownOut
 
bool m_UseCache
 
PLT_MediaCache< NPT_Reference< NPT_List< NPT_String > >, NPT_TimeStampm_DirCache
 

Member Function Documentation

◆ OnBrowseMetadata()

NPT_Result UPNP::CUPnPServer::OnBrowseMetadata ( PLT_ActionReference action,
const char *  object_id,
const char *  filter,
NPT_UInt32  starting_index,
NPT_UInt32  requested_count,
const char *  sort_criteria,
const PLT_HttpRequestContext context 
)
overridevirtual
Todo:
We need to keep track of the overall SystemUpdateID of the CDS

Reimplemented from PLT_FileMediaServerDelegate.

◆ OnUpdateObject()

NPT_Result UPNP::CUPnPServer::OnUpdateObject ( PLT_ActionReference action,
const char *  object_id,
NPT_Map< NPT_String, NPT_String > &  current_vals,
NPT_Map< NPT_String, NPT_String > &  new_vals,
const PLT_HttpRequestContext context 
)
overridevirtual

TODO: we should find a way to avoid obtaining the artwork just to

Todo:
implement this

Implements PLT_MediaServerDelegate.

◆ ProcessGetSCPD()

NPT_Result UPNP::CUPnPServer::ProcessGetSCPD ( PLT_Service service,
NPT_HttpRequest request,
const NPT_HttpRequestContext context,
NPT_HttpResponse response 
)
overridevirtual

This method is called when a control point is requesting a service SCPD.

Parameters
servicethe service
requestthe HTTP request
contextthe context information including local and remote socket information.
responsethe response to setup.

Reimplemented from PLT_MediaConnect.

◆ SetupIcons()

NPT_Result UPNP::CUPnPServer::SetupIcons ( )
overridevirtual

Default implementation for registering device icon resources.

Override to use different ones. Called when device starts.

Reimplemented from PLT_DeviceHost.

◆ SetupServices()

NPT_Result UPNP::CUPnPServer::SetupServices ( )
overridevirtual

Required method for setting up UPnP services of device host (and any embedded).

Called when device starts.

Reimplemented from PLT_MediaConnect.


The documentation for this class was generated from the following files: