
{"id":9975,"date":"2022-06-21T09:10:35","date_gmt":"2022-06-21T09:10:35","guid":{"rendered":"https:\/\/developer.rdkcentral.com\/documentation\/documentation\/documentation\/rdk_video_documentation\/components\/open-sourced_components\/xfinity-universal_plug_and_play_xupnp\/"},"modified":"2025-03-25T05:18:36","modified_gmt":"2025-03-25T05:18:36","slug":"universal_plug_and_play_upnp","status":"publish","type":"page","link":"https:\/\/developer.rdkcentral.com\/documentation\/documentation\/rdk_video_documentation\/components\/universal_plug_and_play_upnp\/","title":{"rendered":"Universal Plug and Play (UPnP)"},"content":{"rendered":"<p><br \/>\n <\/p>\n<div class=\"toc-macro client-side-toc-macro  conf-macro output-block\" data-headerelements=\"H1,H2,H3,H4,H5,H6,H7\" data-hasbody=\"false\" data-macro-name=\"toc\"> <\/div>\n\n\n<h2 class=\"wp-block-heading wp-main-header\"><strong>Overview<\/strong><\/h2>\n\n\n<p>Universal Plug and Play&nbsp;(UPnP) is a set of&nbsp;networking protocols&nbsp;that permits networked&nbsp;devices, such as personal computers, printers, Internet gateways,&nbsp;Wi-Fi&nbsp;access points and mobile devices to seamlessly discover each other&#8217;s presence on the network and establish functional&nbsp;network services&nbsp;for data sharing, communications and entertainment. UPnP uses &#8211;<\/p>\n<ul>\n<li>To discover the devices in the network.<\/li>\n<li>To gather additional information from the devices in network.(e.g receiver id, fog url, etc)<\/li>\n<li>To use the gathered additional information obtained for other running processes.<\/li>\n<\/ul>\n<p>Universal Plug and Play (UPnP) is an implementation of the generic GUPnP framework for device discovery and using services from control points. GUPnP is a library for implementing both UPnP clients and services using GObject and LibSoup. It allows for fully asynchronous use without using threads and so cleanly integrates naturally into daemons, and supports all of the UPnP features.<\/p>\n<p>The GUPnP framework consists of the following libraries:<\/p>\n<ul>\n<li>GSSDP implements resource discovery and announcement over SSDP.<\/li>\n<li>GUPnP implements the UPnP specification\n<ul>\n<li>Resource announcement and discovery.<\/li>\n<li>Description.<\/li>\n<li>Control.<\/li>\n<li>Event&nbsp;notification.<\/li>\n<li>Presentation (GUPnP includes basic web server functionality through libsoup).<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<h3 class=\"wp-sub-header\"><strong>Procedure involving in implementation of the GUPnP Client:<\/strong><\/h3>\n<ul>\n<li><strong>Finding Services:<\/strong>&nbsp;Initialize GUPnP and create a control point targeting the service type. Then we connect a signal handler so that we are notified when services we are interested in are found.&nbsp;<\/li>\n<li><strong>Invoking Actions:<\/strong>&nbsp;GUPnP has a set of methods to invoke actions where you pass a NULL-terminated varargs list of (name, GType, value) tuples for the in-arguments, then a NULL-terminated varargs list of (name, GType, return location) tuples for the out-arguments.&nbsp;<\/li>\n<li><strong>Subscribing to state variable change notifications:<\/strong>&nbsp;It is possible to get change notifications for the service state variables that have attribute sendEvents=&#8221;yes&#8221;.<\/li>\n<\/ul>\n\n\n<h2 class=\"wp-block-heading wp-main-header\"><strong>UPnP Applications:<\/strong><\/h2>\n\n\n<h3 class=\"wp-sub-header\"><strong>xdiscovery<\/strong><\/h3>\n<ul>\n<li>The UPnP daemon xdiscovery runs in system on MoCA interface.&nbsp;<\/li>\n<li>While starting the xdiscovery service, we create a UPnP control point with target device type as urn:schemas-upnp-org:device:BasicDevice:1.<\/li>\n<li>Once UPNP control point is added and active in the network, It searchs for the target device types in the network.&nbsp;<\/li>\n<li>The device-proxy-available Signal is emitted when any device which matches target types is found in the network and the event is handled in a callback routine.<\/li>\n<li>The discovery messages contains a few information about the device , Usually the device descriptions is in an XML file and it includes vendor specific information like Manufacturer, Model Name, Serial No, URL to vendor specific web sites etc. Also it lists the services as well if any.<\/li>\n<li>Each service description includes a list of commands to which the service responds with its parameters and arguments.<\/li>\n<li>The UPnP control point subscribes for the notification if any of the service variable changes during run time.&nbsp;After the device is discovered in the network, the UPnP control point send an action by calling the GUPnP API gupnp_service_proxy_send_action() to retrieve device info and its capabilities.&nbsp;After that it add or update the device in device list using its serial number.&nbsp;<\/li>\n<\/ul>\n<p>Gateway set up : Internally UPnP uses a script \/lib\/rdk\/gwSetup.sh to set up the gateway in client devices. Here we sets up the routing table, DNS setting etc.&nbsp;<\/p>\n<div class=\"code panel pdl conf-macro output-block\" data-hasbody=\"true\" data-macro-name=\"code\">\n<div class=\"codeHeader panelHeader pdl\"><b>UPnP Device Information in JSON format<\/b><\/div>\n<div class=\"codeContent panelContent pdl\">\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">{\n \"sno\":\"PAD200067027\",\n \"isgateway\":\"yes\",\n \"gatewayip\":\"169.254.106.182\",\n \"gatewayipv6\":\"null\",\n \"hostMacAddress\":\"84:e0:58:57:73:55\",\n \"gatewayStbIP\":\"69.247.111.43\",\n \"ipv6Prefix\":\"null\",\n \"deviceName\":\"null\",\n \"bcastMacAddress\":\"84:e0:58:57:73:59\",\n \"recvDevType\":\"X1\",\n \"buildVersion\":\"66.77.33p44d5_EXP\",\n \"timezone\":\"US\/Eastern\",\n \"rawoffset\":\"-18000000\",\n \"dstoffset\":\"60\",\n \"dstsavings\":\"3600000\",\n \"usesdaylighttime\":\"yes\",\n \"baseStreamingUrl\":\"http:\/\/127.0.0.1:8080\/videoStreamInit?recorderId=P0118154760\",\n \"requiresTRM\":\"true\",\n \"baseTrmUrl\":\"ws:\/\/127.0.0.1:9988\",\n \"playbackUrl\":\"http:\/\/127.0.0.1:8080\/hnStreamStart?deviceId=P0118154760&amp;DTCP1HOST=127.0.0.1&amp;DTCP1PORT=5000\",\n \"hosts\":\"69.247.111.43 pacexg1v3;\",\n \"systemids\":\"channelMapId:1901;controllerId:3415;plantId:0;vodServerId:70001\",\n \"receiverid\":\"P0118154760\"\n}<\/pre>\n<\/div>\n<\/div>\n<h3 class=\"wp-sub-header\"><strong>XCal-Device module<\/strong><\/h3>\n<p>XcCal-Device module is responssible for getting the following device discovery information.<\/p>\n<ul>\n<li>Read the upnp configuration details from configuration file.<\/li>\n<li>Getting the input for different gateway to populate all the service veriables.<\/li>\n<li>It act like a server &amp; whenever requested it will give the services details such as ipv6 ip address, receiver Id, etc.<\/li>\n<li>Once the xcal-device receive the services details, it will create a UPnP object and start publishing the UPnP data.<\/li>\n<\/ul>\n\n\n<h2 class=\"wp-block-heading wp-main-header\"><span><strong>API Specification<\/strong><\/span><\/h2>\n\n\n<p>Refer the link&nbsp;<a href=\"https:\/\/wiki.rdkcentral.com\/doxygen\/rdkv-opensourced\/df\/ddc\/group___x_u_p_n_p.html\" rel=\"nofollow\">UPnP API Documentation<\/a> for more implementation details of XCal-Device and XCal-Discovery used in RDK.<\/p>\n<\/p>\n<p><\/p>","protected":false},"excerpt":{"rendered":"<p>Overview Universal Plug and Play&nbsp;(UPnP) is a set of&nbsp;networking protocols&nbsp;that permits networked&nbsp;devices, such as personal [&hellip;]<\/p>\n","protected":false},"author":28,"featured_media":0,"parent":9844,"menu_order":22,"comment_status":"open","ping_status":"closed","template":"","meta":{"_bbp_topic_count":0,"_bbp_reply_count":0,"_bbp_total_topic_count":0,"_bbp_total_reply_count":0,"_bbp_voice_count":0,"_bbp_anonymous_reply_count":0,"_bbp_topic_count_hidden":0,"_bbp_reply_count_hidden":0,"_bbp_forum_subforum_count":0,"footnotes":""},"class_list":["post-9975","page","type-page","status-publish","hentry"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v24.9 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Universal Plug and Play (UPnP) - RDK Documentation Portal | Documentation<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/developer.rdkcentral.com\/documentation\/documentation\/rdk_video_documentation\/components\/universal_plug_and_play_upnp\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Universal Plug and Play (UPnP) - RDK Documentation Portal | Documentation\" \/>\n<meta property=\"og:description\" content=\"Overview Universal Plug and Play&nbsp;(UPnP) is a set of&nbsp;networking protocols&nbsp;that permits networked&nbsp;devices, such as personal [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/developer.rdkcentral.com\/documentation\/documentation\/rdk_video_documentation\/components\/universal_plug_and_play_upnp\/\" \/>\n<meta property=\"og:site_name\" content=\"RDK Documentation Portal | Documentation\" \/>\n<meta property=\"article:modified_time\" content=\"2025-03-25T05:18:36+00:00\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/developer.rdkcentral.com\/documentation\/documentation\/rdk_video_documentation\/components\/universal_plug_and_play_upnp\/\",\"url\":\"https:\/\/developer.rdkcentral.com\/documentation\/documentation\/rdk_video_documentation\/components\/universal_plug_and_play_upnp\/\",\"name\":\"Universal Plug and Play (UPnP) - RDK Documentation Portal | Documentation\",\"isPartOf\":{\"@id\":\"https:\/\/developer.rdkcentral.com\/documentation\/#website\"},\"datePublished\":\"2022-06-21T09:10:35+00:00\",\"dateModified\":\"2025-03-25T05:18:36+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/developer.rdkcentral.com\/documentation\/documentation\/rdk_video_documentation\/components\/universal_plug_and_play_upnp\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/developer.rdkcentral.com\/documentation\/documentation\/rdk_video_documentation\/components\/universal_plug_and_play_upnp\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/developer.rdkcentral.com\/documentation\/documentation\/rdk_video_documentation\/components\/universal_plug_and_play_upnp\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/developer.rdkcentral.com\/documentation\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Documentation\",\"item\":\"https:\/\/developer.rdkcentral.com\/documentation\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"RDK Entertainment\",\"item\":\"https:\/\/developer.rdkcentral.com\/documentation\/documentation\/rdk_video_documentation\/\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"Components\",\"item\":\"https:\/\/developer.rdkcentral.com\/documentation\/documentation\/rdk_video_documentation\/components\/\"},{\"@type\":\"ListItem\",\"position\":5,\"name\":\"Universal Plug and Play (UPnP)\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/developer.rdkcentral.com\/documentation\/#website\",\"url\":\"https:\/\/developer.rdkcentral.com\/documentation\/\",\"name\":\"RDK Documentation Portal | Documentation\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/developer.rdkcentral.com\/documentation\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Universal Plug and Play (UPnP) - RDK Documentation Portal | Documentation","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/developer.rdkcentral.com\/documentation\/documentation\/rdk_video_documentation\/components\/universal_plug_and_play_upnp\/","og_locale":"en_US","og_type":"article","og_title":"Universal Plug and Play (UPnP) - RDK Documentation Portal | Documentation","og_description":"Overview Universal Plug and Play&nbsp;(UPnP) is a set of&nbsp;networking protocols&nbsp;that permits networked&nbsp;devices, such as personal [&hellip;]","og_url":"https:\/\/developer.rdkcentral.com\/documentation\/documentation\/rdk_video_documentation\/components\/universal_plug_and_play_upnp\/","og_site_name":"RDK Documentation Portal | Documentation","article_modified_time":"2025-03-25T05:18:36+00:00","twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/developer.rdkcentral.com\/documentation\/documentation\/rdk_video_documentation\/components\/universal_plug_and_play_upnp\/","url":"https:\/\/developer.rdkcentral.com\/documentation\/documentation\/rdk_video_documentation\/components\/universal_plug_and_play_upnp\/","name":"Universal Plug and Play (UPnP) - RDK Documentation Portal | Documentation","isPartOf":{"@id":"https:\/\/developer.rdkcentral.com\/documentation\/#website"},"datePublished":"2022-06-21T09:10:35+00:00","dateModified":"2025-03-25T05:18:36+00:00","breadcrumb":{"@id":"https:\/\/developer.rdkcentral.com\/documentation\/documentation\/rdk_video_documentation\/components\/universal_plug_and_play_upnp\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/developer.rdkcentral.com\/documentation\/documentation\/rdk_video_documentation\/components\/universal_plug_and_play_upnp\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/developer.rdkcentral.com\/documentation\/documentation\/rdk_video_documentation\/components\/universal_plug_and_play_upnp\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/developer.rdkcentral.com\/documentation\/"},{"@type":"ListItem","position":2,"name":"Documentation","item":"https:\/\/developer.rdkcentral.com\/documentation\/"},{"@type":"ListItem","position":3,"name":"RDK Entertainment","item":"https:\/\/developer.rdkcentral.com\/documentation\/documentation\/rdk_video_documentation\/"},{"@type":"ListItem","position":4,"name":"Components","item":"https:\/\/developer.rdkcentral.com\/documentation\/documentation\/rdk_video_documentation\/components\/"},{"@type":"ListItem","position":5,"name":"Universal Plug and Play (UPnP)"}]},{"@type":"WebSite","@id":"https:\/\/developer.rdkcentral.com\/documentation\/#website","url":"https:\/\/developer.rdkcentral.com\/documentation\/","name":"RDK Documentation Portal | Documentation","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/developer.rdkcentral.com\/documentation\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"}]}},"_links":{"self":[{"href":"https:\/\/developer.rdkcentral.com\/documentation\/wp-json\/wp\/v2\/pages\/9975","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/developer.rdkcentral.com\/documentation\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/developer.rdkcentral.com\/documentation\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/developer.rdkcentral.com\/documentation\/wp-json\/wp\/v2\/users\/28"}],"replies":[{"embeddable":true,"href":"https:\/\/developer.rdkcentral.com\/documentation\/wp-json\/wp\/v2\/comments?post=9975"}],"version-history":[{"count":5,"href":"https:\/\/developer.rdkcentral.com\/documentation\/wp-json\/wp\/v2\/pages\/9975\/revisions"}],"predecessor-version":[{"id":12200,"href":"https:\/\/developer.rdkcentral.com\/documentation\/wp-json\/wp\/v2\/pages\/9975\/revisions\/12200"}],"up":[{"embeddable":true,"href":"https:\/\/developer.rdkcentral.com\/documentation\/wp-json\/wp\/v2\/pages\/9844"}],"wp:attachment":[{"href":"https:\/\/developer.rdkcentral.com\/documentation\/wp-json\/wp\/v2\/media?parent=9975"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}