1 /*  $Id: innfeed.h 9923 2015-07-14 16:48:11Z iulius $
2 **
3 **  innfeed's configuration values.
4 **
5 **  Written by James Brister <brister@vix.com>
6 **
7 **  The application configuration values.  This file is #include'd before any
8 **  system header files, so it can't rely on any CPP symbols other that what
9 **  the compiler defines.
10 */
11 
12 #if ! defined ( innfeed_h__ )
13 #define innfeed_h__
14 
15 #include "inn/timer.h"
16 
17 /**********************************************************************/
18 /*                     Application specific defines                   */
19 /**********************************************************************/
20 
21 /* the path to the run-time config file. If relative, then relative to
22    @ETCDIR@. Overridden by ``-c'' option. */
23 #define CONFIG_FILE "innfeed.conf"
24 
25 
26 /*
27  * This next section contains things than can be overridden in the config
28  * file. The strings inside each comment is the key used in the
29  * innfeed.conf file to override the value here. See innfeed.conf for a
30  * description of each./
31  */
32 
33 /* in tape.c */
34 #define TAPE_DIRECTORY 	        "innfeed"   /* [pathspool]/backlog-directory */
35 #define TAPE_HIGHWATER 		5 		/* backlog-highwater */
36 #define TAPE_ROTATE_PERIOD 	60 		/* backlog-rotate-period */
37 #define TAPE_CHECKPOINT_PERIOD 	30 		/* backlog-ckpt-period */
38 #define TAPE_NEWFILE_PERIOD 	600 		/* backlog-newfile-period */
39 #define TAPE_DISABLE		false		/* no-backlog */
40 
41 /* in main.c */
42 #define PID_FILE 		"innfeed.pid" 	/* [pathrun]/pid-file */
43 #define LOG_FILE 		"innfeed.log"	/* [pathlog]/log-file */
44 
45 /* in host.c */
46 #define DNS_RETRY_PERIOD 	900 		/* dns-retry */
47 #define DNS_EXPIRE_PERIOD 	86400 		/* dns-expire */
48 #define CLOSE_PERIOD 		(60 * 60 * 24) 	/* close-period */
49 #define GEN_HTML		false 		/* gen-html */
50 #define INNFEED_STATUS 		"innfeed.status" /* status-file */
51 #define LOG_CONNECTION_STATS 	0 		/* connection-stats */
52 #define HOST_HIGHWATER 		10 		/* host-queue-highwater */
53 #define STATS_PERIOD 		(60 * 10) 	/* stats-period */
54 #define STATS_RESET_PERIOD 	(60 * 60 * 12) 	/* stats-reset-period */
55 
56 #define ARTTOUT		 	600 		/* article-timeout */
57 #define RESPTOUT	 	300 		/* response-timeout */
58 #define INIT_CXNS		1 		/* initial-connections */
59 #define MAX_CXNS		2 		/* max-connections */
60 #define MAX_Q_SIZE		20 		/* max-queue-size */
61 #define STREAM			true 		/* streaming */
62 #define NOCHECKHIGH 		95.0 		/* no-check-high */
63 #define NOCHECKLOW 		90.0 		/* no-check-low */
64 #define PORTNUM 		119 		/* port-number */
65 #define FORCE_IPv4		false		/* force using IPv4 */
66 #define BLOGLIMIT		0 		/* backlog-limit */
67 #define LIMIT_FUDGE 		1.10 		/* backlog-factor */
68 #define BLOGLIMIT_HIGH		0 		/* backlog-limit-high */
69 
70 #define INIT_RECON_PER 30 	/* initial-reconnect-time */
71 #define MAX_RECON_PER (60 * 60 * 1)/* max-reconnect-time */
72 
73 
74 
75 
76 
77 
78 
79 /****************************************************************************/
80 /*
81  * The rest below are not run-time configurable.
82  */
83 
84 /* If this file exists at startup then it's the same as having done
85    '-d 1' on the command line. This is a cheap way of avoiding continual
86    reloading of the newsfeeds file when debugging. */
87 #define DEBUG_FILE "innfeed.debug" /* Relative to pathlog */
88 
89 /* if defined to a non-zero number, then a snapshot will be printed
90    whenever die() is called (e.g. on assert failure). This can use up a
91    lot of disk space. */
92 #define SNAPSHOT_ON_DIE 0
93 
94 /* the full pathname of the file to get a printed dump of the system when
95    a SIGINT is delivered (or SNAPSHOT_ON_DIE is non-zero--see below). */
96 #define SNAPSHOT_FILE "innfeed.snapshot" /* Relative to pathlog */
97 
98 /* strings that get added to the end of a peer name for generating
99    backlog file names.  A peername cannot end in any of these string
100    (e.g. having a peer called 'mypeer.input' will not work) */
101 #define OUTPUT_TAIL ".output"
102 #define INPUT_TAIL ".input"
103 #define LOCK_TAIL ".lock"
104 
105 /* rough estimate of average article line length (including
106    headers). Smaller number means more efficient article preparation (for
107    transfer), but, if much smaller than reality, then more memory
108    wastage. */
109 #define CHARS_PER_LINE 60
110 
111 /* How many seconds between logging statistics on article allocation.
112    For no logging set to 0 */
113 #define ARTICLE_STATS_PERIOD (10 * 60) /* 10 minutes */
114 
115 /* max number of parallel connections to a single remote. This is just a
116    sanity check for the runtime config file. */
117 #define MAX_CONNECTION_COUNT 50
118 
119 /* default size in bytes for buffers */
120 #define BUFFER_SIZE 256
121 
122 /* amount we expand buffers on partial reads */
123 #define BUFFER_EXPAND_AMOUNT 128
124 
125 /* minimum number of seconds between log messages for starting
126    spooling. i.e. if the connection bounces up and down this will prevent
127    frequent logging of the spooling message. 0 turns off this logging. */
128 #define SPOOL_LOG_PERIOD 600
129 
130 /* some big numbers just for sanity checking */
131 #define MAX_MAXCHECKS 10000     /* no more than 10000 articles at a time */
132 #define MAX_MAXART_TOUT 86400   /* one day max between articles from inn */
133 #define MAX_RESP_TOUT 3600      /* one hour max to wait for response */
134 
135 /* the check / no-check filter value, i.e. roughly how many past
136    articles we take into account whilst doing the average for
137    check / no-check mode.
138    Ensure it's a float. */
139 #define FILTERVALUE 50.0
140 
141 /* the maximum number of peers we'll handle (not connections) */
142 #define MAX_HOSTS 100
143 
144 /* We try to keep article memory allocation below this limit. Doesn't work
145    very well, though. */
146 #define SOFT_ARTICLE_BYTE_LIMIT (1024 * 1024 * 10) /* 10MB */
147 
148 /* define SELECT_RATIO to the number of times through the main loop before
149    checking on the fd from inn again.... */
150 #define SELECT_RATIO 3
151 
152 
153 #if defined (DBTIMES)
154 
155   /* some small values for testing things. */
156 
157 #undef STATS_PERIOD
158 #define STATS_PERIOD 30   /* 30 seconds */
159 
160 #undef STATS_RESET_PERIOD
161 #define STATS_RESET_PERIOD (6 * 60) /* 6 minutes */
162 
163 #undef ARTICLE_STATS_PERIOD
164 #define ARTICLE_STATS_PERIOD (6 * 60) /* 7 minutes */
165 
166 #undef CLOSE_PERIOD
167 #define CLOSE_PERIOD (3 * 60)   /* 5 minutes */
168 
169 #endif /* DBTIMES */
170 
171 
172 /* Additional OS-specific defines.  These should really be moved into
173    configure at some point. */
174 
175 /* Some broken system (all SunOS versions) have a lower limit for the
176    maximum number of stdio files that can be open, than the limit of open
177    file the OS will let you have. If this value is > 0 (and ``stdio-fdmax''
178    is *not* used in the config file), then all non-stdio file descriptors
179    will be kept above this value (by dup'ing them). */
180 #if defined (sun)
181 # if defined (__SVR4)
182 #  define MAX_STDIO_FD 256
183 # else
184 #  define MAX_STDIO_FD 128
185 # endif
186 #else
187 # define MAX_STDIO_FD 0
188 #endif
189 
190 /* some timer constants */
191 
192 typedef enum { TMR_IDLE = TMR_APPLICATION, TMR_BACKLOGSTATS,
193   TMR_STATUSFILE, TMR_NEWARTICLE, TMR_READART, TMR_PREPART, TMR_READ,
194   TMR_WRITE, TMR_CALLBACK, TMR_MAX
195 } TMRTYPE;
196 
197 #endif /* innfeed_h__ */
198