1 /* $Id: upnpglobalvars.h,v 1.48 2019/05/21 08:39:45 nanard Exp $ */ 2 /* vim: tabstop=4 shiftwidth=4 noexpandtab 3 * MiniUPnP project 4 * http://miniupnp.free.fr/ or https://miniupnp.tuxfamily.org/ 5 * (c) 2006-2020 Thomas Bernard 6 * This software is subject to the conditions detailed 7 * in the LICENCE file provided within the distribution */ 8 9 #ifndef UPNPGLOBALVARS_H_INCLUDED 10 #define UPNPGLOBALVARS_H_INCLUDED 11 12 #include <time.h> 13 #include "upnppermissions.h" 14 #include "miniupnpdtypes.h" 15 #include "config.h" 16 17 /* name of the network interface used to access internet */ 18 extern const char * ext_if_name; 19 20 #ifdef ENABLE_IPV6 21 /* name of the network interface used to access internet - for IPv6*/ 22 extern const char * ext_if_name6; 23 #endif 24 25 /* stun host/port configuration */ 26 extern const char * ext_stun_host; 27 extern uint16_t ext_stun_port; 28 29 /* file to store all leases */ 30 #ifdef ENABLE_LEASEFILE 31 extern const char * lease_file; 32 #endif 33 34 /* forced ip address to use for this interface 35 * when NULL, getifaddr() is used */ 36 extern const char * use_ext_ip_addr; 37 38 /* disallow all port forwarding requests when 39 * we are behind restrictive nat */ 40 extern int disable_port_forwarding; 41 42 /* parameters to return to upnp client when asked */ 43 extern unsigned long downstream_bitrate; 44 extern unsigned long upstream_bitrate; 45 46 /* statup time */ 47 extern time_t startup_time; 48 #if defined(ENABLE_NATPMP) || defined(ENABLE_PCP) 49 /* origin for "epoch time" sent into NATPMP and PCP responses */ 50 extern time_t epoch_origin; 51 #endif /* defined(ENABLE_NATPMP) || defined(ENABLE_PCP) */ 52 53 extern unsigned long int min_lifetime; 54 extern unsigned long int max_lifetime; 55 56 /* runtime boolean flags */ 57 extern int runtime_flags; 58 #define LOGPACKETSMASK 0x0001 59 #define SYSUPTIMEMASK 0x0002 60 #ifdef ENABLE_NATPMP 61 #define ENABLENATPMPMASK 0x0004 62 #endif 63 #define CHECKCLIENTIPMASK 0x0008 64 #define SECUREMODEMASK 0x0010 65 66 #define ENABLEUPNPMASK 0x0020 67 68 #ifdef PF_ENABLE_FILTER_RULES 69 #define PFNOQUICKRULESMASK 0x0040 70 #endif 71 #ifdef ENABLE_IPV6 72 #define IPV6DISABLEDMASK 0x0080 73 #endif 74 #ifdef ENABLE_6FC_SERVICE 75 #define IPV6FCFWDISABLEDMASK 0x0100 76 #define IPV6FCINBOUNDDISALLOWEDMASK 0x0200 77 #endif 78 #ifdef ENABLE_PCP 79 #define PCP_ALLOWTHIRDPARTYMASK 0x0400 80 #endif 81 #ifdef IGD_V2 82 #define FORCEIGDDESCV1MASK 0x0800 83 #endif 84 85 #define PERFORMSTUNMASK 0x1000 86 87 #define SETFLAG(mask) runtime_flags |= mask 88 #define GETFLAG(mask) (runtime_flags & mask) 89 #define CLEARFLAG(mask) runtime_flags &= ~mask 90 91 extern const char * pidfilename; 92 93 extern char uuidvalue_igd[]; /* uuid of root device (IGD) */ 94 extern char uuidvalue_wan[]; /* uuid of WAN Device */ 95 extern char uuidvalue_wcd[]; /* uuid of WAN Connection Device */ 96 97 #define SERIALNUMBER_MAX_LEN (10) 98 extern char serialnumber[]; 99 100 #define MODELNUMBER_MAX_LEN (48) 101 extern char modelnumber[]; 102 103 #define PRESENTATIONURL_MAX_LEN (64) 104 extern char presentationurl[]; 105 106 #ifdef ENABLE_MANUFACTURER_INFO_CONFIGURATION 107 #define FRIENDLY_NAME_MAX_LEN (64) 108 extern char friendly_name[]; 109 110 #define MANUFACTURER_NAME_MAX_LEN (64) 111 extern char manufacturer_name[]; 112 113 #define MANUFACTURER_URL_MAX_LEN (64) 114 extern char manufacturer_url[]; 115 116 #define MODEL_NAME_MAX_LEN (64) 117 extern char model_name[]; 118 119 #define MODEL_DESCRIPTION_MAX_LEN (64) 120 extern char model_description[]; 121 122 #define MODEL_URL_MAX_LEN (64) 123 extern char model_url[]; 124 #endif 125 126 /* UPnP permission rules : */ 127 extern struct upnpperm * upnppermlist; 128 extern unsigned int num_upnpperm; 129 130 #ifdef PCP_SADSCP 131 extern struct dscp_values* dscp_values_list; 132 extern unsigned int num_dscp_values; 133 #endif 134 135 /* For automatic removal of expired rules (with LeaseDuration) */ 136 extern unsigned int nextruletoclean_timestamp; 137 138 #ifdef USE_PF 139 extern const char * anchor_name; 140 /* queue and tag for PF rules */ 141 extern const char * queue; 142 extern const char * tag; 143 #endif 144 145 #ifdef ENABLE_NFQUEUE 146 extern int nfqueue; 147 extern int n_nfqix; 148 extern unsigned nfqix[]; 149 #endif 150 151 /* lan addresses to listen to SSDP traffic */ 152 extern struct lan_addr_list lan_addrs; 153 154 #ifdef ENABLE_IPV6 155 /* ipv6 address used for HTTP */ 156 extern char ipv6_addr_for_http_with_brackets[64]; 157 158 /* address used to bind local services */ 159 extern struct in6_addr ipv6_bind_addr; 160 161 #endif /* ENABLE_IPV6 */ 162 163 extern const char * minissdpdsocketpath; 164 165 /* BOOTID.UPNP.ORG and CONFIGID.UPNP.ORG */ 166 extern unsigned int upnp_bootid; 167 extern unsigned int upnp_configid; 168 169 #ifdef RANDOMIZE_URLS 170 #define RANDOM_URL_MAX_LEN (16) 171 extern char random_url[]; 172 #endif /* RANDOMIZE_URLS */ 173 174 #endif /* UPNPGLOBALVARS_H_INCLUDED */ 175