add configId attribute to <root> element (UDA 1.1)

This commit is contained in:
Thomas Bernard 2016-02-16 10:55:03 +01:00
parent 8c5e90db3a
commit 13a6a38241
2 changed files with 10 additions and 2 deletions

View File

@ -1,7 +1,7 @@
/* $Id: testupnpdescgen.c,v 1.32 2014/03/10 11:04:52 nanard Exp $ */
/* MiniUPnP project
* http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/
* (c) 2006-2014 Thomas Bernard
* (c) 2006-2016 Thomas Bernard
* This software is subject to the conditions detailed
* in the LICENCE file provided within the distribution */
@ -34,6 +34,7 @@ char model_name[] = ROOTDEV_MODELNAME;
char model_description[] = ROOTDEV_MODELDESCRIPTION;
char model_url[] = ROOTDEV_MODELURL;
#endif
unsigned int upnp_configid = 666;
char * use_ext_ip_addr = NULL;
const char * ext_if_name = "eth0";

View File

@ -2,7 +2,7 @@
/* vim: tabstop=4 shiftwidth=4 noexpandtab */
/* MiniUPnP project
* http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/
* (c) 2006-2015 Thomas Bernard
* (c) 2006-2016 Thomas Bernard
* This software is subject to the conditions detailed
* in the LICENCE file provided within the distribution */
@ -952,6 +952,13 @@ genXML(char * str, int * len, int * tmplen,
/*printf("<%s>\n", eltname); */
str = strcat_char(str, len, tmplen, '<');
str = strcat_str(str, len, tmplen, eltname);
if(memcmp(eltname, "root ", 5) == 0) {
char configid_str[16];
/* add configId attribute, required by UDA 1.1 */
snprintf(configid_str, sizeof(configid_str), "\"%u\"", upnp_configid);
str = strcat_str(str, len, tmplen, " configId=");
str = strcat_str(str, len, tmplen, configid_str);
}
str = strcat_char(str, len, tmplen, '>');
k = (unsigned long)p[i].data;
i = k & 0xffff;