Miniupnpd: update to 1.9 (20150430)
[tomato.git] / release / src / router / miniupnpd / upnpglobalvars.c
blobe515fe193c80195e487fcf23acb7348aa937cd71
1 /* $Id: upnpglobalvars.c,v 1.39 2014/12/10 09:49:22 nanard Exp $ */
2 /* MiniUPnP project
3 * http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/
4 * (c) 2006-2014 Thomas Bernard
5 * This software is subject to the conditions detailed
6 * in the LICENCE file provided within the distribution */
8 #include <sys/types.h>
9 #include <netinet/in.h>
11 #include "config.h"
12 #include "upnpglobalvars.h"
13 #include "upnpdescstrings.h"
15 /* network interface for internet */
16 const char * ext_if_name = 0;
18 /* file to store leases */
19 #ifdef ENABLE_LEASEFILE
20 const char* lease_file = 0;
21 #endif
23 /* forced ip address to use for this interface
24 * when NULL, getifaddr() is used */
25 const char * use_ext_ip_addr = 0;
27 unsigned long downstream_bitrate = 0;
28 unsigned long upstream_bitrate = 0;
30 /* startup time */
31 time_t startup_time = 0;
33 #ifdef ENABLE_PCP
34 /* for PCP */
35 unsigned long int min_lifetime = 120;
36 unsigned long int max_lifetime = 86400;
37 #endif
39 int runtime_flags = 0;
41 const char * pidfilename = "/var/run/miniupnpd.pid";
43 char uuidvalue_igd[] = "uuid:00000000-0000-0000-0000-000000000000";
44 char uuidvalue_wan[] = "uuid:00000000-0000-0000-0000-000000000000";
45 char uuidvalue_wcd[] = "uuid:00000000-0000-0000-0000-000000000000";
46 char serialnumber[SERIALNUMBER_MAX_LEN] = "00000000";
48 char modelnumber[MODELNUMBER_MAX_LEN] = "1";
50 /* presentation url :
51 * http://nnn.nnn.nnn.nnn:ppppp/ => max 30 bytes including terminating 0 */
52 char presentationurl[PRESENTATIONURL_MAX_LEN];
54 #ifdef ENABLE_MANUFACTURER_INFO_CONFIGURATION
55 /* friendly name for root devices in XML description */
56 char friendly_name[FRIENDLY_NAME_MAX_LEN] = OS_NAME " router";
58 /* manufacturer name for root devices in XML description */
59 char manufacturer_name[MANUFACTURER_NAME_MAX_LEN] = ROOTDEV_MANUFACTURER;
61 /* manufacturer url for root devices in XML description */
62 char manufacturer_url[MANUFACTURER_URL_MAX_LEN] = ROOTDEV_MANUFACTURERURL;
64 /* model name for root devices in XML description */
65 char model_name[MODEL_NAME_MAX_LEN] = ROOTDEV_MODELNAME;
67 /* model description for root devices in XML description */
68 char model_description[MODEL_DESCRIPTION_MAX_LEN] = ROOTDEV_MODELDESCRIPTION;
70 /* model url for root devices in XML description */
71 char model_url[MODEL_URL_MAX_LEN] = ROOTDEV_MODELURL;
72 #endif
74 /* UPnP permission rules : */
75 struct upnpperm * upnppermlist = 0;
76 unsigned int num_upnpperm = 0;
78 #ifdef PCP_SADSCP
79 struct dscp_values* dscp_values_list = 0;
80 unsigned int num_dscp_values = 0;
81 #endif /*PCP_SADSCP*/
83 /* For automatic removal of expired rules (with LeaseDuration) */
84 unsigned int nextruletoclean_timestamp = 0;
86 #ifdef USE_PF
87 const char * anchor_name = "miniupnpd";
88 const char * queue = 0;
89 const char * tag = 0;
90 #endif
92 #ifdef USE_NETFILTER
93 /* chain name to use, both in the nat table
94 * and the filter table */
95 const char * miniupnpd_nat_chain = "MINIUPNPD";
96 const char * miniupnpd_peer_chain = "MINIUPNPD-PCP-PEER";
97 const char * miniupnpd_forward_chain = "MINIUPNPD";
98 #ifdef ENABLE_UPNPPINHOLE
99 const char * miniupnpd_v6_filter_chain = "MINIUPNPD";
100 #endif
102 #endif
103 #ifdef ENABLE_NFQUEUE
104 int nfqueue = -1;
105 int n_nfqix = 0;
106 unsigned nfqix[MAX_LAN_ADDR];
107 #endif
108 struct lan_addr_list lan_addrs;
110 #ifdef ENABLE_IPV6
111 /* ipv6 address used for HTTP */
112 char ipv6_addr_for_http_with_brackets[64];
114 /* address used to bind local services */
115 struct in6_addr ipv6_bind_addr;
116 #endif
118 /* Path of the Unix socket used to communicate with MiniSSDPd */
119 const char * minissdpdsocketpath = "/var/run/minissdpd.sock";
121 /* BOOTID.UPNP.ORG and CONFIGID.UPNP.ORG */
122 /* See UPnP Device Architecture v1.1 section 1.2 Advertisement :
123 * The field value of the BOOTID.UPNP.ORG header field MUST be increased
124 * each time a device (re)joins the network and sends an initial announce
125 * (a "reboot" in UPnP terms), or adds a UPnP-enabled interface.
126 * Unless the device explicitly announces a change in the BOOTID.UPNP.ORG
127 * field value using an SSDP message, as long as the device remains
128 * continuously available in the network, the same BOOTID.UPNP.ORG field
129 * value MUST be used in all repeat announcements, search responses,
130 * update messages and eventually bye-bye messages. */
131 unsigned int upnp_bootid = 1; /* BOOTID.UPNP.ORG */
132 /* The field value of the CONFIGID.UPNP.ORG header field identifies the
133 * current set of device and service descriptions; control points can
134 * parse this header field to detect whether they need to send new
135 * description query messages. */
136 /* UPnP 1.1 devices MAY freely assign configid numbers from 0 to
137 * 16777215 (2^24-1). Higher numbers are reserved for future use, and
138 * can be assigned by the Technical Committee. The configuration of a
139 * root device consists of the following information: the DDD of the
140 * root device and all its embedded devices, and the SCPDs of all the
141 * contained services. If any part of the configuration changes, the
142 * CONFIGID.UPNP.ORG field value MUST be changed.
143 * DDD = Device Description Document
144 * SCPD = Service Control Protocol Description */
145 unsigned int upnp_configid = 1337; /* CONFIGID.UPNP.ORG */