cablelabs/rygel — pull request #24 by craigpratt (2014-10-01 00:29:37+00:00)
Title: Adding variable substitution for service-specific parameters

Based on a realization I had while discussing fixes for CVP2RI-407 with Brendan (see pull request 23), I've prototyped a change that allows res block elements to have request/server-specific replacements performed that reflect the target interface.

It's customary for a CDS to produce res URIs that reflect the source interface of UPnP/HTTP requests (esp important when multiple interfaces/addresses are present). Rygel manages the URI host address dependencies in the librygel-server code.

e.g. If Rygel is running on a machine with interface addresses 127.0.0.1, 192.168.122.1, & 10.10.1.186, and receives a UPnP or HTTP HEAD/GET request on 10.10.1.186, all the the res URIs returned will start with "http://10.10.1.186...". If the same request is processed on interface 192.168.122.1, all URIs returned will start with "http://192.168.122.1...".

Currently this logic is limited to the res URI. But by extending host-address replacement into other res block elements, we can remove host address dependencies from other elements of the code - and properly support multi-homed setups at the same time. i.e. We can remove the need to specify the "dtcp-host" setting in Rygel.conf, host IP addresses in DASH URIs, and likely the resource URIs returned from the RUIH service.

I logic to do address substitution on the mime-type value (where the "DTCP1HOST" parameter lives) and it seems to work as expected.

e.g. I have three interfaces on my VM - and the DTCP1HOST param is set accordingly without setting the "dtcp-host" parameter in the config file:

curl -I "http://192.168.122.1:4004/ODIDMediaServer/i/..."
Content-Type: application/x-dtcp1;DTCP1HOST=10.10.1.186;DTCP1PORT=8999;CONTENTFORMAT="video/vnd.dlna.mpeg-tts"

curl -I "http://127.0.0.1:4004/ODIDMediaServer/i/..."
Content-Type: application/x-dtcp1;DTCP1HOST=127.0.0.1;DTCP1PORT=8999;CONTENTFORMAT="video/vnd.dlna.mpeg-tts"

curl -I "http://10.10.1.186:4004/ODIDMediaServer/i/..."
Content-Type: application/x-dtcp1;DTCP1HOST=10.10.1.186;DTCP1PORT=8999;CONTENTFORMAT="video/vnd.dlna.mpeg-tts"

CDS browse responses are similarly adapted. And cached resources retain the replacement string. So if the interface changes between Rygel runs, even cached res block values will be properly substituted.

The rygel.conf now has a different default value for http-host:

dtcp-host=@SERVICE_ADDRESS@

dtcp-host can still be set explicitly - by script or otherwise - if desired. But hopefully with this value, the script won't have to replace this value. And our DMS will support multi-homed setups.

The UIList.xml.in now has a similar default value for the application URIs:

1234-9876-1265-8758
CableLabs Program Guide
CableLabs Program Guide application
true
-1

http://@SERVICE_ADDRESS@:80/index.html

The URI here can be set explicitly as well. But this is a much better default. And hopefully this will be another value that doesn't need to be tweaked via script.

The "uri" value in resource.info can also be written using "@SERVICE_ADDRESS@". e.g. for a MPEG-DASH item:

basename=SDBigBuck
profile=DASH_MPD
uri=http://@SERVICE_ADDRESS@/DASH_AVC_MP4_SD/O-DASH_AVC_MP4_SD-007.mpd
size=1435
mime-type=application/dash+xml
protected=false
converted=false