Added friendl_name= option to config file

This commit is contained in:
Thomas Bernard 2012-02-05 00:24:13 +01:00
parent 87a8a06640
commit a0a1e45ac5
10 changed files with 46 additions and 25 deletions

View File

@ -1,4 +1,7 @@
$Id: Changelog.txt,v 1.251 2012/02/03 15:10:10 nanard Exp $
$Id: Changelog.txt,v 1.252 2012/02/04 23:05:20 nanard Exp $
2012/02/04:
Added friendl_name= option to config file
2012/02/03:
Anchor name (PF) is now configurable through the config file with anchor=

View File

@ -1,7 +1,7 @@
/* $Id: miniupnpd.c,v 1.140 2012/02/03 14:39:24 nanard Exp $ */
/* $Id: miniupnpd.c,v 1.141 2012/02/04 23:05:22 nanard Exp $ */
/* MiniUPnP project
* http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/
* (c) 2006-2011 Thomas Bernard
* (c) 2006-2012 Thomas Bernard
* This software is subject to the conditions detailed
* in the LICENCE file provided within the distribution */
@ -662,6 +662,10 @@ init(int argc, char * * argv, struct runtime_vars * v)
case UPNPPRESENTATIONURL:
presurl = ary_options[i].value;
break;
case UPNPFRIENDLY_NAME:
strncpy(friendly_name, ary_options[i].value, FRIENDLY_NAME_MAX_LEN);
friendly_name[FRIENDLY_NAME_MAX_LEN-1] = '\0';
break;
#ifdef USE_NETFILTER
case UPNPFORWARDCHAIN:
miniupnpd_forward_chain = ary_options[i].value;

View File

@ -37,6 +37,9 @@ enable_upnp=yes
# lease file location
#lease_file=/var/log/upnp.leases
# name of this service, default is "`uname -s` Router"
#friendly_name=MiniUPnPd router
# bitrates reported by daemon in bits per second
bitrate_up=1000000
bitrate_down=10000000

View File

@ -1,8 +1,8 @@
/* $Id: options.c,v 1.21 2012/02/03 11:59:16 nanard Exp $ */
/* $Id: options.c,v 1.22 2012/02/04 23:05:21 nanard Exp $ */
/* MiniUPnP project
* http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/
* author: Ryan Wagoner
* (c) 2006 Thomas Bernard
* (c) 2006-2012 Thomas Bernard
* This software is subject to the conditions detailed
* in the LICENCE file provided within the distribution */
@ -29,6 +29,7 @@ static const struct {
{ UPNPBITRATE_UP, "bitrate_up" },
{ UPNPBITRATE_DOWN, "bitrate_down" },
{ UPNPPRESENTATIONURL, "presentation_url" },
{ UPNPFRIENDLY_NAME, "friendly_name" },
{ UPNPNOTIFY_INTERVAL, "notify_interval" },
{ UPNPSYSTEM_UPTIME, "system_uptime" },
{ UPNPPACKET_LOG, "packet_log" },

View File

@ -1,8 +1,8 @@
/* $Id: options.h,v 1.16 2012/02/03 11:59:16 nanard Exp $ */
/* $Id: options.h,v 1.17 2012/02/04 23:05:21 nanard Exp $ */
/* MiniUPnP project
* http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/
* author: Ryan Wagoner
* (c) 2006 Thomas Bernard
* (c) 2006-2012 Thomas Bernard
* This software is subject to the conditions detailed
* in the LICENCE file provided within the distribution */
@ -21,6 +21,7 @@ enum upnpconfigoptions {
UPNPBITRATE_UP, /* "bitrate_up" */
UPNPBITRATE_DOWN, /* "bitrate_down" */
UPNPPRESENTATIONURL, /* presentation_url */
UPNPFRIENDLY_NAME, /* "friendly_name" */
UPNPNOTIFY_INTERVAL, /* notify_interval */
UPNPSYSTEM_UPTIME, /* "system_uptime" */
UPNPPACKET_LOG, /* "packet_log" */

View File

@ -1,7 +1,7 @@
/* $Id: testupnpdescgen.c,v 1.25 2011/05/18 22:22:23 nanard Exp $ */
/* $Id: testupnpdescgen.c,v 1.26 2012/02/04 23:05:21 nanard Exp $ */
/* MiniUPnP project
* http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/
* (c) 2006-2011 Thomas Bernard
* (c) 2006-2012 Thomas Bernard
* This software is subject to the conditions detailed
* in the LICENCE file provided within the distribution */
@ -21,6 +21,7 @@ char serialnumber[] = "12345678";
char modelnumber[] = "1";
char presentationurl[] = "http://192.168.0.1:8080/";
/*char presentationurl[] = "";*/
char friendly_name[] = OS_NAME " router";
char * use_ext_ip_addr = NULL;
const char * ext_if_name = "eth0";

View File

@ -1,7 +1,7 @@
/* $Id: upnpdescgen.c,v 1.63 2011/05/27 21:36:50 nanard Exp $ */
/* $Id: upnpdescgen.c,v 1.64 2012/02/04 23:05:21 nanard Exp $ */
/* MiniUPnP project
* http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/
* (c) 2006-2011 Thomas Bernard
* (c) 2006-2012 Thomas Bernard
* This software is subject to the conditions detailed
* in the LICENCE file provided within the distribution */
@ -145,7 +145,7 @@ static const struct XMLElt rootDesc[] =
/* 5 */
{"/deviceType", DEVICE_TYPE_IGD},
/* urn:schemas-upnp-org:device:InternetGatewayDevice:1 or 2 */
{"/friendlyName", ROOTDEV_FRIENDLYNAME}, /* required */
{"/friendlyName", friendly_name/*ROOTDEV_FRIENDLYNAME*/}, /* required */
{"/manufacturer", ROOTDEV_MANUFACTURER}, /* required */
/* 8 */
{"/manufacturerURL", ROOTDEV_MANUFACTURERURL}, /* optional */
@ -1151,7 +1151,7 @@ genEventVars(int * len, const struct serviceDesc * s, const char * servns)
str = strcat_str(str, len, &tmplen, "<e:property><s:");
str = strcat_str(str, len, &tmplen, v->name);
str = strcat_str(str, len, &tmplen, ">");
//printf("<e:property><s:%s>", v->name);
/*printf("<e:property><s:%s>", v->name);*/
switch(v->ieventvalue) {
case 0:
break;
@ -1213,14 +1213,16 @@ genEventVars(int * len, const struct serviceDesc * s, const char * servns)
str = strcat_str(str, len, &tmplen, "</s:");
str = strcat_str(str, len, &tmplen, v->name);
str = strcat_str(str, len, &tmplen, "></e:property>");
//printf("</s:%s></e:property>\n", v->name);
/*printf("</s:%s></e:property>\n", v->name);*/
}
v++;
}
str = strcat_str(str, len, &tmplen, "</e:propertyset>");
//printf("</e:propertyset>\n");
//printf("\n");
//printf("%d\n", tmplen);
#if 0
printf("</e:propertyset>\n");
printf("\n");
printf("%d\n", tmplen);
#endif
str[*len] = '\0';
return str;
}

View File

@ -1,7 +1,7 @@
/* $Id: upnpdescstrings.h,v 1.5 2007/02/09 10:12:52 nanard Exp $ */
/* $Id: upnpdescstrings.h,v 1.6 2012/02/04 23:05:21 nanard Exp $ */
/* miniupnp project
* http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/
* (c) 2006 Thomas Bernard
* (c) 2006-2012 Thomas Bernard
* This software is subject to the coditions detailed in
* the LICENCE file provided within the distribution */
#ifndef __UPNPDESCSTRINGS_H__
@ -10,7 +10,7 @@
#include "config.h"
/* strings used in the root device xml description */
#define ROOTDEV_FRIENDLYNAME OS_NAME " router"
/*#define ROOTDEV_FRIENDLYNAME OS_NAME " router"*/
#define ROOTDEV_MANUFACTURER OS_NAME
#define ROOTDEV_MANUFACTURERURL OS_URL
#define ROOTDEV_MODELNAME OS_NAME " router"

View File

@ -1,7 +1,7 @@
/* $Id: upnpglobalvars.c,v 1.26 2012/02/03 11:59:16 nanard Exp $ */
/* $Id: upnpglobalvars.c,v 1.27 2012/02/04 23:05:21 nanard Exp $ */
/* MiniUPnP project
* http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/
* (c) 2006-2010 Thomas Bernard
* (c) 2006-2012 Thomas Bernard
* This software is subject to the conditions detailed
* in the LICENCE file provided within the distribution */
@ -43,7 +43,10 @@ char modelnumber[MODELNUMBER_MAX_LEN] = "1";
/* presentation url :
* http://nnn.nnn.nnn.nnn:ppppp/ => max 30 bytes including terminating 0 */
char presentationurl[PRESENTATIONURL_MAX_LEN];
char presentationurl[PRESENTATIONURL_MAX_LEN];
/* friendly name for root devices in XML description */
char friendly_name[FRIENDLY_NAME_MAX_LEN] = OS_NAME " router";
/* UPnP permission rules : */
struct upnpperm * upnppermlist = 0;

View File

@ -1,7 +1,7 @@
/* $Id: upnpglobalvars.h,v 1.30 2012/02/03 11:59:16 nanard Exp $ */
/* $Id: upnpglobalvars.h,v 1.31 2012/02/04 23:05:21 nanard Exp $ */
/* MiniUPnP project
* http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/
* (c) 2006-2011 Thomas Bernard
* (c) 2006-2012 Thomas Bernard
* This software is subject to the conditions detailed
* in the LICENCE file provided within the distribution */
@ -65,6 +65,9 @@ extern char modelnumber[];
#define PRESENTATIONURL_MAX_LEN (64)
extern char presentationurl[];
#define FRIENDLY_NAME_MAX_LEN (64)
extern char friendly_name[];
/* UPnP permission rules : */
extern struct upnpperm * upnppermlist;
extern unsigned int num_upnpperm;