| 17 | | == Device custom configuration - jmsizun == |
|---|
| 18 | | |
|---|
| 19 | | I am currently working in branch {{{client-device-config}}} on a way to externalize in the config file |
|---|
| 20 | | client device or specificities such as: |
|---|
| 21 | | - adherence to specific mimetype or DLNA additionnal info for given data types |
|---|
| 22 | | - transcoding profiles |
|---|
| 23 | | - DLNA support |
|---|
| 24 | | - protocols idioms |
|---|
| 25 | | - ... |
|---|
| 26 | | |
|---|
| 27 | | |
|---|
| 28 | | This works by identifying client devices thanks to characteristics such as IP address, Ethernet MAC address, |
|---|
| 29 | | HTTP user-agent or alternative HTTP header and associate them to specific paremeters. |
|---|
| 30 | | The config actually defines a set of 'rules', which are read through by the framework when needed. Each 'rule' associates |
|---|
| 31 | | a given criterium (ex: IP address is XX.XX.XX.XX) with one or more parameter. Different rules can apply to a given client, |
|---|
| 32 | | and they are handled in the order they appear. For each applying rule, the parameters are added or overwrite the previous ones. |
|---|
| 33 | | |
|---|
| 34 | | Parameters can be: |
|---|
| 35 | | - "tag": a tag which will modify the framework behaviour. Currently supported tags are: |
|---|
| 36 | | - NO_TRANSCODING: the client device does not support transcoded resources, or thre is no need to transcode anything. |
|---|
| 37 | | - NO_DLNA_ADDITIONNAL_INFO: the client device doe not support any info other than the generic "*" value as additionnal value in the UPnP resources information. |
|---|
| 38 | | - NO_REF_ID |
|---|
| 39 | | - SIMULATE_WMC_SERVER: useful for Microsoft-style devices (XBOX, WMP...) |
|---|
| 40 | | Other tags can be defined (For instance, in order to control access to specific backends from a given set of devices: see below) |
|---|
| 41 | | - "forced-mimetype". All resources with a given mimetype will be presented to the client with another mimetype value (usefull when a device will not recognize the firsg mimetype). The mimetype may be replaced by a type family: audio, video or image. |
|---|
| 42 | | - "transcoders": list of transcoding profile (e.g. lpcm, mpegps..) to apply to ressources with a given mimetype. The special profile "native" corresponds to the native resource: it has to be provided if we want this resource to be present. The mimetype may be replaced by a type family: audio, video or image. |
|---|
| 43 | | - "dlna_additional_info" (for DLNA certified devices). All resource with a given mimetype will be presented to the client with the configuration value (usefull when a device will only accept a given value) |
|---|
| 44 | | - "device-info": free text characterizing the device (useful for logging) |
|---|
| 45 | | |
|---|
| 46 | | Rules criteria can be: |
|---|
| 47 | | - "all": applies to any client device |
|---|
| 48 | | - "user-agent": applies to any device for which the HTTP client device matches a given regular expression |
|---|
| 49 | | - "ip": applies to any device for which the IP address matches a given value |
|---|
| 50 | | - "mac": applies to any device for which the MAC address matches a given value (not supported yet) |
|---|
| 51 | | - "http-header": applies to any device for which the HTTP header contains a given key/value ({{{value}}}/{{{value2}}}) |
|---|
| 52 | | |
|---|
| 53 | | |
|---|
| 54 | | Sample configuration (to be included within the {{{<config>}}} element) |
|---|
| 55 | | |
|---|
| 56 | | {{{ |
|---|
| 57 | | <devices> |
|---|
| 58 | | <rule type="all"> |
|---|
| 59 | | <device-info>Generic device</device-info> |
|---|
| 60 | | <forced-mimetype mimetype="video/x-msvideo">video/divx</forced-mimetype> |
|---|
| 61 | | <forced-mimetype mimetype="video/avi">video/divx</forced-mimetype> |
|---|
| 62 | | <transcoders mimetype="audio">native,lpcm</transcoders> |
|---|
| 63 | | <transcoders mimetype="video">native,mpegts</transcoders> |
|---|
| 64 | | </rule> |
|---|
| 65 | | <rule type="user-agent" value="Coherence"> |
|---|
| 66 | | <device-info>Coherence</device-info> |
|---|
| 67 | | <!--<tag>NO_TRANSCODING</tag>--> |
|---|
| 68 | | </rule> |
|---|
| 69 | | <rule type="user-agent" value="Xbox/"> |
|---|
| 70 | | <device-info>XBox</device-info> |
|---|
| 71 | | <tag>XBox</tag> |
|---|
| 72 | | <tag>NO_DLNA_ADDITIONAL_INFO</tag> |
|---|
| 73 | | <tag>NO_REF_ID</tag> |
|---|
| 74 | | <tag>SIMULATE_WMC_SERVER</tag> |
|---|
| 75 | | <forced-mimetype mimetype="video/x-msvideo">video/avi</forced-mimetype> |
|---|
| 76 | | <forced-mimetype mimetype="video/divx">video/avi</forced-mimetype> |
|---|
| 77 | | <forced-mimetype mimetype="audio/x-wav">audio/wav</forced-mimetype> |
|---|
| 78 | | <transcoders mimetype="audio">mp3</transcoders> |
|---|
| 79 | | </rule> |
|---|
| 80 | | <rule type="user-agent" value="Mozilla/4.0 \(compatible; UPnP/1.0; Windows"> |
|---|
| 81 | | <device-info>Windows Media Player</device-info> |
|---|
| 82 | | <tag>SIMULATE_WMC_SERVER</tag> |
|---|
| 83 | | </rule> |
|---|
| 84 | | <rule type="user-agent" value="FDSSDP"> |
|---|
| 85 | | <device-info>Windows 7</device-info> |
|---|
| 86 | | <tag>SIMULATE_WMC_SERVER</tag> |
|---|
| 87 | | </rule> |
|---|
| 88 | | <rule type="user-agent" value="fbxupnpav"> |
|---|
| 89 | | <device-info>Freebox HD</device-info> |
|---|
| 90 | | <forced-mimetype mimetype="video/x-msvideo">video/avi</forced-mimetype> |
|---|
| 91 | | <forced-mimetype mimetype="video/divx">video/avi</forced-mimetype> |
|---|
| 92 | | </rule> |
|---|
| 93 | | <rule type="user-agent" value="Philips-Software-WebClient"> |
|---|
| 94 | | <device-info>Philips-TV</device-info> |
|---|
| 95 | | <tag>NO_DLNA_ADDITIONAL_INFO</tag> |
|---|
| 96 | | </rule> |
|---|
| 97 | | <rule type="user-agent" value="Allegro-Software-WebClient"> |
|---|
| 98 | | <device-info>Philips-TV</device-info> |
|---|
| 99 | | <tag>NO_DLNA_ADDITIONAL_INFO</tag> |
|---|
| 100 | | </rule> |
|---|
| 101 | | <rule type="http-header" value="x-av-client-info" value2="PLAYSTATION3"> |
|---|
| 102 | | <device-info>Playstation 3</device-info> |
|---|
| 103 | | <dlna_additional_info mimetype="video">*</dlna_additional_info> |
|---|
| 104 | | </rule> |
|---|
| 105 | | <rule type="http-header" value="x-av-client-info" value2="BRAVIA KDL" > |
|---|
| 106 | | <device-info>Sony Bravia KDL</device-info> |
|---|
| 107 | | <dlna_additional_info mimetype="video/mpegts">MPEG_TS_SD_EU_ISO</dlna_additional_info> |
|---|
| 108 | | </rule> |
|---|
| 109 | | </devices> |
|---|
| 110 | | }}} |
|---|
| 111 | | |
|---|
| 112 | | |
|---|
| 113 | | |
|---|
| 114 | | == Per-device Access-Control to backends - jmsizun == |
|---|
| 115 | | |
|---|
| 116 | | ! Work in progress in branch {{{client-device-config}}} ! |
|---|
| 117 | | |
|---|
| 118 | | You can filter access to the backend on a per-device basis, either with: |
|---|
| 119 | | - a whitelist: no device can access the backend resources, except for the ones specifically identified (allowed) |
|---|
| 120 | | - a blacklist: all devices can access the backend resources, except for the ones specifically identified (denied) |
|---|
| 121 | | Devices are not identified directly in the black/list lists, but through tags. |
|---|
| 122 | | |
|---|
| 123 | | A blacklist can be defined in the backend configuration, by adding the {{{deny}}} element, with a commas-separated list of tags (Any device with one of the tag will be denied. All others will be allowed). |
|---|
| 124 | | |
|---|
| 125 | | A whitelist can be defined in the backend configuration, by adding the {{{allow}}} element, with a commas-separated list of tags (Any device with one of the tag will be allowed. All others will be denied). |
|---|
| 126 | | |
|---|
| 127 | | Defining both a black list and a white liste is invalid. |
|---|
| 128 | | |
|---|
| 129 | | === Examples === |
|---|
| 130 | | |
|---|
| 131 | | To allow all devices except device A (children device) to access backend B: |
|---|
| 132 | | - choose a tag to describe the denied device(s): e.g. {{{CHILDREN_DEVICE}}} |
|---|
| 133 | | - add a new rule identifying the device (e.g. by IP) and defining tag {{{CHILDREN_DEVICE}}} |
|---|
| 134 | | - add the following element to backend B definition: {{{<deny>CHILDREN_DEVICE</deny>}}} |
|---|
| 135 | | |
|---|
| 136 | | To deny all devices except device A (device) to access backend B: |
|---|
| 137 | | - choose a tag to describe the allowed device(s): e.g. {{{GOD_DEVICE}}} |
|---|
| 138 | | - add a new rule identifying the device (e.g. by IP, or by type: XBox) and setting tag {{{GOD_DEVICE}}} |
|---|
| 139 | | - add the following element to backend B definition: {{{<allow>GOD_DEVICE</allow>}}} |
|---|
| 140 | | - other devices can be allowed, by adding a new rule identifying the device and setting tag {{{GOD_DEVICE}}} |
|---|
| 141 | | |
|---|
| 142 | | == custom data types mapping - jmsizun == |
|---|
| 143 | | |
|---|
| 144 | | ! Work in progress in branch {{{client-device-config}}} ! |
|---|
| 145 | | |
|---|
| 146 | | it is possible to add new mappings if the framework does not behave as expected with your files: |
|---|
| 147 | | - file extension to mimetype |
|---|
| 148 | | - mimetype to UPnPClass |
|---|
| 149 | | |
|---|
| 150 | | Just edit your configuration file as in the sample below. |
|---|
| 151 | | |
|---|
| 152 | | {{{ |
|---|
| 153 | | <mapping type="extension-mimetype" from="torrent" to="application/x-bittorrent"/> |
|---|
| 154 | | <mapping type="mimetype-upnpclass" from="application/x-bittorrent" to="object.item.videoItem"/> |
|---|
| 155 | | }}} |
|---|
| 156 | | |
|---|
| 157 | | Notes: file extension value are to be provided with no dot. UPnP classes are to be provided with the fully qualified name. |
|---|
| | 17 | see [wiki:Branch_clientDeviceConfig] |
|---|