TOR: fix compilation
[tomato.git] / release / src / router / miniupnpd / upnpglobalvars.c
blob1d1f47718e5e18851413ec1f330bbab825738f51
1 /* $Id: upnpglobalvars.c,v 1.40 2016/02/09 09:37:44 nanard Exp $ */
2 /* MiniUPnP project
3 * http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/
4 * (c) 2006-2016 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 /* "rdr-anchor miniupnpd" or/and "anchor miniupnpd" in pf.conf */
88 const char * anchor_name = "miniupnpd";
89 const char * queue = 0;
90 const char * tag = 0;
91 #endif
93 #ifdef USE_NETFILTER
94 /* chain names to use in the nat and filter tables. */
96 /* iptables -t nat -N MINIUPNPD
97 * iptables -t nat -A PREROUTING -i <ext_if_name> -j MINIUPNPD */
98 const char * miniupnpd_nat_chain = "MINIUPNPD";
100 /* iptables -t nat -N MINIUPNPD-POSTROUTING
101 * iptables -t nat -A POSTROUTING -o <ext_if_name> -j MINIUPNPD-POSTROUTING */
102 const char * miniupnpd_nat_postrouting_chain = "MINIUPNPD-POSTROUTING";
104 /* iptables -t filter -N MINIUPNPD
105 * iptables -t filter -A FORWARD -i <ext_if_name> ! -o <ext_if_name> -j MINIUPNPD */
106 const char * miniupnpd_forward_chain = "MINIUPNPD";
108 #ifdef ENABLE_UPNPPINHOLE
109 /* ip6tables -t filter -N MINIUPNPD
110 * ip6tables -t filter -A FORWARD -i <ext_if_name> ! -o <ext_if_name> -j MINIUPNPD */
111 const char * miniupnpd_v6_filter_chain = "MINIUPNPD";
112 #endif /* ENABLE_UPNPPINHOLE */
114 #endif /* USE_NETFILTER */
116 #ifdef ENABLE_NFQUEUE
117 int nfqueue = -1;
118 int n_nfqix = 0;
119 unsigned nfqix[MAX_LAN_ADDR];
120 #endif /* ENABLE_NFQUEUE */
122 struct lan_addr_list lan_addrs;
124 #ifdef ENABLE_IPV6
125 /* ipv6 address used for HTTP */
126 char ipv6_addr_for_http_with_brackets[64];
128 /* address used to bind local services */
129 struct in6_addr ipv6_bind_addr;
130 #endif
132 /* Path of the Unix socket used to communicate with MiniSSDPd */
133 const char * minissdpdsocketpath = "/var/run/minissdpd.sock";
135 /* BOOTID.UPNP.ORG and CONFIGID.UPNP.ORG */
136 /* See UPnP Device Architecture v1.1 section 1.2 Advertisement :
137 * The field value of the BOOTID.UPNP.ORG header field MUST be increased
138 * each time a device (re)joins the network and sends an initial announce
139 * (a "reboot" in UPnP terms), or adds a UPnP-enabled interface.
140 * Unless the device explicitly announces a change in the BOOTID.UPNP.ORG
141 * field value using an SSDP message, as long as the device remains
142 * continuously available in the network, the same BOOTID.UPNP.ORG field
143 * value MUST be used in all repeat announcements, search responses,
144 * update messages and eventually bye-bye messages. */
145 unsigned int upnp_bootid = 1; /* BOOTID.UPNP.ORG */
146 /* The field value of the CONFIGID.UPNP.ORG header field identifies the
147 * current set of device and service descriptions; control points can
148 * parse this header field to detect whether they need to send new
149 * description query messages. */
150 /* UPnP 1.1 devices MAY freely assign configid numbers from 0 to
151 * 16777215 (2^24-1). Higher numbers are reserved for future use, and
152 * can be assigned by the Technical Committee. The configuration of a
153 * root device consists of the following information: the DDD of the
154 * root device and all its embedded devices, and the SCPDs of all the
155 * contained services. If any part of the configuration changes, the
156 * CONFIGID.UPNP.ORG field value MUST be changed.
157 * DDD = Device Description Document
158 * SCPD = Service Control Protocol Description */
159 unsigned int upnp_configid = 1337; /* CONFIGID.UPNP.ORG */