00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00031
00032 #ifdef HAVE_CONFIG_H
00033 #include "autoconfig.h"
00034 #endif
00035
00036 #if defined(ENABLE_MRREG)
00037
00038 #include "tools.h"
00039 #include "upnp_mrreg.h"
00040 #include "server.h"
00041 #include "upnp_xml.h"
00042 #include "ixml.h"
00043 #include "storage.h"
00044
00045 using namespace zmm;
00046 using namespace mxml;
00047
00048 void MRRegistrarService::process_subscription_request(zmm::Ref<SubscriptionRequest> request)
00049 {
00050 int err;
00051 IXML_Document *event = NULL;
00052
00053 Ref<Element> propset, property;
00054
00055 propset = UpnpXML_CreateEventPropertySet();
00056 property = propset->getFirstElementChild();
00057 property->appendTextChild(_("ValidationRevokedUpdateID"), _("0"));
00058 property->appendTextChild(_("ValidationSucceededUpdateID"), _("0"));
00059 property->appendTextChild(_("AuthorizationDeniedUpdateID"), _("0"));
00060 property->appendTextChild(_("AuthorizationGrantedUpdateID"), _("0"));
00061
00062 String xml = propset->print();
00063 err = ixmlParseBufferEx(xml.c_str(), &event);
00064 if (err != IXML_SUCCESS)
00065 {
00066 throw UpnpException(UPNP_E_SUBSCRIPTION_FAILED, _("Could not convert property set to ixml"));
00067 }
00068
00069 UpnpAcceptSubscriptionExt(Server::getInstance()->getDeviceHandle(),
00070 ConfigManager::getInstance()->getOption(CFG_SERVER_UDN).c_str(),
00071 serviceID.c_str(), event, request->getSubscriptionID().c_str());
00072
00073 ixmlDocument_free(event);
00074 }
00075 #if 0
00076 void MRRegistrarService::subscription_update(String sourceProtocol_CSV)
00077 {
00078 int err;
00079 IXML_Document *event = NULL;
00080
00081 Ref<Element> propset, property;
00082
00083 propset = UpnpXML_CreateEventPropertySet();
00084 property = propset->getFirstChild();
00085 property->appendTextChild(_("SourceProtocolInfo"), sourceProtocol_CSV);
00086
00087 String xml = propset->print();
00088
00089 err = ixmlParseBufferEx(xml.c_str(), &event);
00090 if (err != IXML_SUCCESS)
00091 {
00093 throw UpnpException(UPNP_E_SUBSCRIPTION_FAILED, _("Could not convert property set to ixml"));
00094
00095 }
00096
00097 UpnpNotifyExt(Server::getInstance()->getDeviceHandle(),
00098 ConfigManager::getInstance()->getOption(CFG_SERVER_UDN).c_str(),
00099 serviceID.c_str(), event);
00100
00101 ixmlDocument_free(event);
00102 }
00103 #endif
00104
00105 #endif // ENABLE_MRREG