Mercurial > pt1.oyama
annotate src/msr.c @ 171:6c710e5a28b8
Support latest upnp-api
author | Naoya OYAMA <naoya.oyama@gmail.com> |
---|---|
date | Tue, 23 Oct 2012 20:31:01 +0900 |
parents | 2a9ac5ce2c7e |
children |
rev | line source |
---|---|
125 | 1 /* |
2 * msr.c : GeeXboX uShare Microsoft Registrar Service. | |
3 * Originally developped for the GeeXboX project. | |
4 * Copyright (C) 2006 Benjamin Zores <ben@geexbox.org> | |
5 * | |
6 * This program is free software; you can redistribute it and/or modify | |
7 * it under the terms of the GNU General Public License as published by | |
8 * the Free Software Foundation; either version 2 of the License, or | |
9 * (at your option) any later version. | |
10 * | |
11 * This program is distributed in the hope that it will be useful, | |
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 * GNU Library General Public License for more details. | |
15 * | |
16 * You should have received a copy of the GNU General Public License along | |
17 * with this program; if not, write to the Free Software Foundation, | |
18 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |
19 */ | |
20 | |
136
2a9ac5ce2c7e
Remove internal libdlna and libupnp.(using OS package by default)
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
125
diff
changeset
|
21 #include <upnp.h> |
2a9ac5ce2c7e
Remove internal libdlna and libupnp.(using OS package by default)
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
125
diff
changeset
|
22 #include <upnptools.h> |
125 | 23 |
24 #include "ushare.h" | |
25 #include "services.h" | |
26 | |
27 /* Represent the MSR IsAuthorized action. */ | |
28 #define SERVICE_MSR_ACTION_IS_AUTHORIZED "IsAuthorized" | |
29 | |
30 /* Represent the MSR RegisterDevice action. */ | |
31 #define SERVICE_MSR_ACTION_REGISTER_DEVICE "RegisterDevice" | |
32 | |
33 /* Represent the MSR IsValidated action. */ | |
34 #define SERVICE_MSR_ACTION_IS_VALIDATED "IsValidated" | |
35 | |
36 /* Represent the MSR DeviceID argument. */ | |
37 #define SERVICE_MSR_ARG_DEVICE_ID "DeviceID" | |
38 | |
39 /* Represent the MSR Result argument. */ | |
40 #define SERVICE_MSR_ARG_RESULT "Result" | |
41 | |
42 /* Represent the MSR RegistrationReqMsg argument. */ | |
43 #define SERVICE_MSR_ARG_REGISTRATION_REQUEST_MSG "RegistrationReqMsg" | |
44 | |
45 /* Represent the MSR RegistrationRespMsg argument. */ | |
46 #define SERVICE_MSR_ARG_REGISTRATION_RESPONSE_MSG "RegistrationRespMsg" | |
47 | |
48 /* Represent the MSR Registered/Activated ID value. */ | |
49 #define SERVICE_MSR_STATUS_OK "1" | |
50 | |
51 static bool | |
52 msr_is_authorized (struct action_event_t *event) | |
53 { | |
54 if (!event) | |
55 return false; | |
56 | |
57 /* send a fake authorization to these stupid MS players ;-) */ | |
58 upnp_add_response (event, SERVICE_MSR_ARG_RESULT, SERVICE_MSR_STATUS_OK); | |
59 | |
60 return event->status; | |
61 } | |
62 | |
63 static bool | |
64 msr_register_device (struct action_event_t *event) | |
65 { | |
66 if (!event) | |
67 return false; | |
68 | |
69 /* dummy action */ | |
70 | |
71 return event->status; | |
72 } | |
73 | |
74 static bool | |
75 msr_is_validated (struct action_event_t *event) | |
76 { | |
77 if (!event) | |
78 return false; | |
79 | |
80 /* send a fake validation to these stupid MS players ;-) */ | |
81 upnp_add_response (event, SERVICE_MSR_ARG_RESULT, SERVICE_MSR_STATUS_OK); | |
82 | |
83 return event->status; | |
84 } | |
85 | |
86 /* List of UPnP Microsoft Registrar Service actions */ | |
87 struct service_action_t msr_service_actions[] = { | |
88 { SERVICE_MSR_ACTION_IS_AUTHORIZED, msr_is_authorized }, | |
89 { SERVICE_MSR_ACTION_REGISTER_DEVICE, msr_register_device }, | |
90 { SERVICE_MSR_ACTION_IS_VALIDATED, msr_is_validated }, | |
91 { NULL, NULL } | |
92 }; |