chiark / gitweb /
some todos
[inn-innduct.git] / innfeed / innfeed.h
1 /*  $Id: innfeed.h 7559 2006-08-28 02:10:39Z eagle $
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 overriden 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-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              5               /* 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 /* Define this be an existing directory (or NULL). If innfeed deliberatly
99    dumps core it will chdir() to this directory first (if non-NULL). If
100    NULL then it will chdir to TAPE_DIRECTORY (as possibly modified by
101    the '-b' option). */
102 #define CORE_DIRECTORY NULL
103
104 /* strings that get added to the end of a peer name for generating
105    backlog file names.  A peername cannot end in any of these string
106    (e.g. having a peer called 'mypeer.input' will not work) */
107 #define OUTPUT_TAIL ".output"
108 #define INPUT_TAIL ".input"
109 #define LOCK_TAIL ".lock"
110
111 /* rough estimate of average article line length (including
112    headers). Smaller number means more efficient article preparation (for
113    transfer), but, if much smaller than reality, then more memory
114    wastage. */
115 #define CHARS_PER_LINE 60
116
117 /* How many seconds between logging statistics on article allocation.
118    For no logging set to 0 */
119 #define ARTICLE_STATS_PERIOD (10 * 60) /* 10 minutes */
120
121 /* max number of parallel connections to a single remote. This is just a
122    sanity check for the runtime config file. */
123 #define MAX_CONNECTION_COUNT 50
124
125 /* default size in bytes for buffers */
126 #define BUFFER_SIZE 256
127
128 /* amount we expand buffers on partial reads */
129 #define BUFFER_EXPAND_AMOUNT 128 
130
131 /* minimum number of seconds between log messages for starting
132    spooling. i.e. if the connection bounces up and down this will prevent
133    frequent logging of the spooling message. 0 turns off this logging. */
134 #define SPOOL_LOG_PERIOD 600
135
136 /* some big numbers just for sanity checking */
137 #define MAX_MAXCHECKS 10000     /* no more than 10000 articles at a time */
138 #define MAX_MAXART_TOUT 86400   /* one day max between articles from inn */
139 #define MAX_RESP_TOUT 3600      /* one hour max to wait for response */
140
141 /* the check / no-check filter value, i.e. roughly how many past
142    articles we take into account whilst doing the average for
143    check / no-check mode.
144    Ensure it's a float. */
145 #define FILTERVALUE 50.0
146
147 /* the maximum number of peers we'll handle (not connections) */
148 #define MAX_HOSTS 100
149
150 /* We try to keep article memory allocation below this limit. Doesn't work
151    very well, though. */
152 #define SOFT_ARTICLE_BYTE_LIMIT (1024 * 1024 * 10) /* 10MB */
153
154 /* define SELECT_RATIO to the number of times through the main loop before
155    checking on the fd from inn again.... */
156 #define SELECT_RATIO 3
157
158
159 #if defined (DBTIMES)
160
161   /* some small values for testing things. */
162
163 #undef STATS_PERIOD
164 #define STATS_PERIOD 30   /* 30 seconds */
165
166 #undef STATS_RESET_PERIOD
167 #define STATS_RESET_PERIOD (6 * 60) /* 6 minutes */
168
169 #undef ARTICLE_STATS_PERIOD
170 #define ARTICLE_STATS_PERIOD (6 * 60) /* 7 minutes */
171
172 #undef CLOSE_PERIOD
173 #define CLOSE_PERIOD (3 * 60)   /* 5 minutes */
174
175 #endif /* DBTIMES */
176
177
178 /* Additional OS-specific defines.  These should really be moved into
179    configure at some point. */
180
181 /* Some broken system (all SunOS versions) have a lower limit for the
182    maximum number of stdio files that can be open, than the limit of open
183    file the OS will let you have. If this value is > 0 (and ``stdio-fdmax''
184    is *not* used in the config file), then all non-stdio file descriptors
185    will be kept above this value (by dup'ing them). */
186 #if defined (sun)
187 # if defined (__SVR4)
188 #  define MAX_STDIO_FD 256
189 # else
190 #  define MAX_STDIO_FD 128
191 # endif
192 #else
193 # define MAX_STDIO_FD 0
194 #endif
195
196 /* some timer constants */
197
198 typedef enum { TMR_IDLE = TMR_APPLICATION, TMR_BACKLOGSTATS,
199   TMR_STATUSFILE, TMR_NEWARTICLE, TMR_READART, TMR_PREPART, TMR_READ,
200   TMR_WRITE, TMR_CALLBACK, TMR_MAX
201 } TMRTYPE;
202
203 #endif /* innfeed_h__ */