comparison libdlna-0.2.3/src/upnp_dms.c @ 129:4f6d9621ee00

add multi session streaming & add depending librarys. - libupnp-1.6.6 - libdlna-0.2.3
author Naoya OYAMA <naoya.oyama@gmail.com>
date Sun, 10 Oct 2010 15:33:18 +0900
parents
children
comparison
equal deleted inserted replaced
128:3a7d8d2f0585 129:4f6d9621ee00
1 /*
2 * libdlna: reference DLNA standards implementation.
3 * Copyright (C) 2007 Benjamin Zores <ben@geexbox.org>
4 *
5 * This file is part of libdlna.
6 *
7 * libdlna is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
11 *
12 * libdlna is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with libdlna; if not, write to the Free Software
19 * Foundation, Inc, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 */
21
22 #include <stdio.h>
23 #include <string.h>
24
25 #include "dlna_internals.h"
26
27 #define UPNP_DMS_DESCRIPTION \
28 "<?xml version=\"1.0\" encoding=\"utf-8\"?>" \
29 "<root xmlns=\"urn:schemas-upnp-org:device-1-0\">" \
30 " <specVersion>" \
31 " <major>1</major>" \
32 " <minor>0</minor>" \
33 " </specVersion>" \
34 " <device>" \
35 " <deviceType>urn:schemas-upnp-org:device:MediaServer:1</deviceType>" \
36 " <friendlyName>%s: 1</friendlyName>" \
37 " <manufacturer>%s</manufacturer>" \
38 " <manufacturerURL>%s</manufacturerURL>" \
39 " <modelDescription>%s</modelDescription>" \
40 " <modelName>%s</modelName>" \
41 " <modelNumber>%s</modelNumber>" \
42 " <modelURL>%s</modelURL>" \
43 " <serialNumber>%s</serialNumber>" \
44 " <UDN>uuid:%s</UDN>" \
45 " <presentationURL>%s</presentationURL>" \
46 " <dlna:X_DLNADOC>DMS-1.00</dlna:X_DLNADOC>" \
47 " <serviceList>" \
48 " <service>" \
49 " <serviceType>urn:schemas-upnp-org:service:ConnectionManager:1</serviceType>" \
50 " <serviceId>urn:upnp-org:serviceId:ConnectionManager</serviceId>" \
51 " <SCPDURL>%s</SCPDURL>" \
52 " <controlURL>%s</controlURL>" \
53 " <eventSubURL>%s</eventSubURL>" \
54 " </service>" \
55 " <service>" \
56 " <serviceType>urn:schemas-upnp-org:service:ContentDirectory:1</serviceType>" \
57 " <serviceId>urn:upnp-org:serviceId:ContentDirectory</serviceId>" \
58 " <SCPDURL>%s</SCPDURL>" \
59 " <controlURL>%s</controlURL>" \
60 " <eventSubURL>%s</eventSubURL>" \
61 " </service>" \
62 " </serviceList>" \
63 " </device>" \
64 "</root>"
65
66 char *
67 dlna_dms_description_get (const char *friendly_name,
68 const char *manufacturer,
69 const char *manufacturer_url,
70 const char *model_description,
71 const char *model_name,
72 const char *model_number,
73 const char *model_url,
74 const char *serial_number,
75 const char *uuid,
76 const char *presentation_url,
77 const char *cms_scpd_url,
78 const char *cms_control_url,
79 const char *cms_event_url,
80 const char *cds_scpd_url,
81 const char *cds_control_url,
82 const char *cds_event_url)
83 {
84 char *desc = NULL;
85 size_t len;
86
87 if (!friendly_name || !manufacturer || !manufacturer_url ||
88 !model_description || !model_name || !model_number ||
89 !model_url || !serial_number || !uuid || !presentation_url ||
90 !cms_scpd_url || !cms_control_url || !cms_event_url ||
91 !cds_scpd_url || !cds_control_url || !cds_event_url)
92 return NULL;
93
94 len = strlen (UPNP_DMS_DESCRIPTION) + strlen (friendly_name)
95 + strlen (manufacturer) + strlen (manufacturer_url)
96 + strlen (model_description) + strlen (model_name)
97 + strlen (model_number) + strlen (model_url) + strlen (serial_number)
98 + strlen (uuid) + strlen (presentation_url) + strlen (cms_scpd_url)
99 + strlen (cms_control_url) + strlen (cms_event_url)
100 + strlen (cds_scpd_url) + strlen (cds_control_url)
101 + strlen (cds_event_url) + 1;
102
103 desc = malloc (len);
104 memset (desc, 0, len);
105 sprintf (desc, UPNP_DMS_DESCRIPTION, friendly_name,
106 manufacturer, manufacturer_url, model_description,
107 model_name, model_number, model_url, serial_number, uuid,
108 presentation_url, cms_scpd_url, cms_control_url, cms_event_url,
109 cds_scpd_url, cds_control_url, cds_event_url);
110
111 return desc;
112 }