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