From 22f78368165c6f54294f48609cc31d55aa9fb99a Mon Sep 17 00:00:00 2001 From: Thomas Bernard Date: Tue, 16 Feb 2016 10:55:48 +0100 Subject: [PATCH] reorder elements in XML descriptions to follow UDA 1.1 --- miniupnpd/upnpdescgen.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/miniupnpd/upnpdescgen.c b/miniupnpd/upnpdescgen.c index 763d8e5..00199cf 100644 --- a/miniupnpd/upnpdescgen.c +++ b/miniupnpd/upnpdescgen.c @@ -237,9 +237,9 @@ static const struct XMLElt rootDesc[] = "urn:schemas-upnp-org:service:WANCommonInterfaceConfig:1"}, /*{"/serviceId", "urn:upnp-org:serviceId:WANCommonInterfaceConfig"}, */ {"/serviceId", "urn:upnp-org:serviceId:WANCommonIFC1"}, /* required */ + {"/SCPDURL", WANCFG_PATH}, {"/controlURL", WANCFG_CONTROLURL}, {"/eventSubURL", WANCFG_EVENTURL}, - {"/SCPDURL", WANCFG_PATH}, /* 38 */ {"device", INITHELPER(39,12)}, /* 39 */ @@ -268,16 +268,16 @@ static const struct XMLElt rootDesc[] = /* urn:schemas-upnp-org:service:WANIPConnection:2 for v2 */ {"/serviceId", SERVICE_ID_WANIPC}, /* urn:upnp-org:serviceId:WANIPConn1 or 2 */ + {"/SCPDURL", WANIPC_PATH}, {"/controlURL", WANIPC_CONTROLURL}, {"/eventSubURL", WANIPC_EVENTURL}, - {"/SCPDURL", WANIPC_PATH}, #ifdef ENABLE_6FC_SERVICE /* 58 */ {"/serviceType", "urn:schemas-upnp-org:service:WANIPv6FirewallControl:1"}, {"/serviceId", "urn:upnp-org:serviceId:WANIPv6Firewall1"}, + {"/SCPDURL", WANIP6FC_PATH}, {"/controlURL", WANIP6FC_CONTROLURL}, {"/eventSubURL", WANIP6FC_EVENTURL}, - {"/SCPDURL", WANIP6FC_PATH}, #endif /* 58 / 63 = SERVICES_OFFSET*/ #if defined(HAS_DUMMY_SERVICE) || defined(ENABLE_L3F_SERVICE) || defined(ENABLE_DP_SERVICE) @@ -288,17 +288,17 @@ static const struct XMLElt rootDesc[] = /* 60 / 65 = SERVICES_OFFSET+2 */ {"/serviceType", "urn:schemas-dummy-com:service:Dummy:1"}, {"/serviceId", "urn:dummy-com:serviceId:dummy1"}, + {"/SCPDURL", DUMMY_PATH}, {"/controlURL", "/dummy"}, {"/eventSubURL", "/dummy"}, - {"/SCPDURL", DUMMY_PATH}, #endif #ifdef ENABLE_L3F_SERVICE /* 60 / 65 = SERVICES_OFFSET+2 */ {"/serviceType", "urn:schemas-upnp-org:service:Layer3Forwarding:1"}, {"/serviceId", "urn:upnp-org:serviceId:L3Forwarding1"}, + {"/SCPDURL", L3F_PATH}, {"/controlURL", L3F_CONTROLURL}, /* The Layer3Forwarding service is only */ {"/eventSubURL", L3F_EVENTURL}, /* recommended, not mandatory */ - {"/SCPDURL", L3F_PATH}, #endif #ifdef ENABLE_DP_SERVICE /* InternetGatewayDevice v2 : @@ -309,9 +309,9 @@ static const struct XMLElt rootDesc[] = /* 65 / 70 = SERVICES_OFFSET+7 */ {"/serviceType", "urn:schemas-upnp-org:service:DeviceProtection:1"}, {"/serviceId", "urn:upnp-org:serviceId:DeviceProtection1"}, + {"/SCPDURL", DP_PATH}, {"/controlURL", DP_CONTROLURL}, {"/eventSubURL", DP_EVENTURL}, - {"/SCPDURL", DP_PATH}, #endif {0, 0} }; @@ -1112,6 +1112,14 @@ genServiceDesc(int * len, const struct serviceDesc * s) str = strcat_str(str, len, &tmplen, ""); str = strcat_str(str, len, &tmplen, upnptypes[vars[i].itype & 0x0f]); str = strcat_str(str, len, &tmplen, ""); + /*if(vars[i].defaultValue) */ + if(vars[i].idefault) + { + str = strcat_str(str, len, &tmplen, ""); + /*str = strcat_str(str, len, &tmplen, vars[i].defaultValue); */ + str = strcat_str(str, len, &tmplen, upnpdefaultvalues[vars[i].idefault]); + str = strcat_str(str, len, &tmplen, ""); + } if(vars[i].iallowedlist) { if((vars[i].itype & 0x0f) == 0) @@ -1134,14 +1142,6 @@ genServiceDesc(int * len, const struct serviceDesc * s) str = strcat_str(str, len, &tmplen, ""); } } - /*if(vars[i].defaultValue) */ - if(vars[i].idefault) - { - str = strcat_str(str, len, &tmplen, ""); - /*str = strcat_str(str, len, &tmplen, vars[i].defaultValue); */ - str = strcat_str(str, len, &tmplen, upnpdefaultvalues[vars[i].idefault]); - str = strcat_str(str, len, &tmplen, ""); - } str = strcat_str(str, len, &tmplen, ""); /*str = strcat_char(str, len, &tmplen, '\n'); // TEMP ! */ i++;