diff --git a/miniupnpd/upnpsoap.c b/miniupnpd/upnpsoap.c
index 21fc33b..e0e5b2b 100644
--- a/miniupnpd/upnpsoap.c
+++ b/miniupnpd/upnpsoap.c
@@ -1,4 +1,4 @@
-/* $Id: upnpsoap.c,v 1.122 2014/03/10 11:04:53 nanard Exp $ */
+/* $Id: upnpsoap.c,v 1.123 2014/04/09 12:39:54 nanard Exp $ */
/* MiniUPnP project
* http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/
* (c) 2006-2014 Thomas Bernard
@@ -1827,6 +1827,97 @@ GetPinholePackets(struct upnphttp * h, const char * action)
}
#endif
+#ifdef ENABLE_DP_SERVICE
+static void
+SendSetupMessage(struct upnphttp * h, const char * action)
+{
+ static const char resp[] =
+ ""
+ "%s"
+ "";
+ char body[1024];
+ int bodylen;
+ struct NameValueParserData data;
+ const char * ProtocolType; /* string */
+ const char * InMessage; /* base64 */
+ const char * OutMessage = ""; /* base64 */
+
+ ParseNameValue(h->req_buf + h->req_contentoff, h->req_contentlen, &data);
+ ProtocolType = GetValueFromNameValueList(&data, "NewProtocolType"); /* string */
+ InMessage = GetValueFromNameValueList(&data, "NewInMessage"); /* base64 */
+
+ if(ProtocolType == NULL || InMessage == NULL)
+ {
+ ClearNameValueList(&data);
+ SoapError(h, 402, "Invalid Args");
+ return;
+ }
+ /*if(strcmp(ProtocolType, "DeviceProtection:1") != 0)*/
+ if(strcmp(ProtocolType, "WPS") != 0)
+ {
+ ClearNameValueList(&data);
+ SoapError(h, 600, "Argument Value Invalid"); /* 703 ? */
+ return;
+ }
+ /* TODO : put here code for WPS */
+
+ bodylen = snprintf(body, sizeof(body), resp,
+ action, "urn:schemas-upnp-org:service:DeviceProtection:1",
+ OutMessage, action);
+ BuildSendAndCloseSoapResp(h, body, bodylen);
+ ClearNameValueList(&data);
+}
+
+static void
+GetSupportedProtocols(struct upnphttp * h, const char * action)
+{
+ static const char resp[] =
+ ""
+ "%s"
+ "";
+ char body[1024];
+ int bodylen;
+ const char * ProtocolList =
+ "\n"
+ ""
+ "WPS"
+ "PKCS5"
+ "";
+
+ bodylen = snprintf(body, sizeof(body), resp,
+ action, "urn:schemas-upnp-org:service:DeviceProtection:1",
+ ProtocolList, action);
+ BuildSendAndCloseSoapResp(h, body, bodylen);
+}
+
+static void
+GetAssignedRoles(struct upnphttp * h, const char * action)
+{
+ static const char resp[] =
+ ""
+ "%s"
+ "";
+ char body[1024];
+ int bodylen;
+ const char * RoleList;
+
+ if(h->ssl != NULL)
+ RoleList = "Admin Basic";
+ else
+ RoleList = "Public";
+
+ bodylen = snprintf(body, sizeof(body), resp,
+ action, "urn:schemas-upnp-org:service:DeviceProtection:1",
+ RoleList, action);
+ BuildSendAndCloseSoapResp(h, body, bodylen);
+}
+#endif
/* Windows XP as client send the following requests :
* GetConnectionTypeInfo
@@ -1884,6 +1975,12 @@ soapMethods[] =
{ "DeletePinhole", DeletePinhole}, /* Required */
{ "CheckPinholeWorking", CheckPinholeWorking}, /* Optional */
{ "GetPinholePackets", GetPinholePackets}, /* Required */
+#endif
+#ifdef ENABLE_DP_SERVICE
+ /* DeviceProtection */
+ { "SendSetupMessage", SendSetupMessage}, /* Required */
+ { "GetSupportedProtocols", GetSupportedProtocols}, /* Required */
+ { "GetAssignedRoles", GetAssignedRoles}, /* Required */
#endif
{ 0, 0 }
};