chiark / gitweb /
Add __oop-read-copy.c
[innduct.git] / include / inn / innconf.h
1 /*  $Id: innconf.h 7751 2008-04-06 14:35:40Z iulius $
2 **
3 **  inn.conf parser interface.
4 **
5 **  The interface to reading inn.conf configuration files and managing the
6 **  resulting innconf struct.
7 */
8
9 #ifndef INN_INNCONF_H
10 #define INN_INNCONF_H 1
11
12 #include <inn/defines.h>
13 #include <stdio.h>
14
15 /*
16 **  This structure is organized in the same order as the variables contained
17 **  in it are mentioned in the inn.conf documentation, and broken down into
18 **  the same sections.  Note that due to the implementation, only three types
19 **  of variables are permissible here:  char *, bool, and long.
20 */
21 struct innconf {
22     /* General Settings */
23     char *domain;               /* Default domain of local host */
24     char *innflags;             /* Flags to pass to innd on startup */
25     char *mailcmd;              /* Command to send report/control type mail */
26     char *mta;                  /* MTA for mailing to moderators, innmail */
27     char *pathhost;             /* Entry for the Path line */
28     char *server;               /* Default server to connect to */
29
30     /* Feed Configuration */
31     long artcutoff;             /* Max accepted article age */
32     char *bindaddress;          /* Which interface IP to bind to */
33     char *bindaddress6;         /* Which interface IPv6 to bind to */
34     bool dontrejectfiltered;    /* Don't reject filtered article? */
35     long hiscachesize;          /* Size of the history cache in kB */
36     bool ignorenewsgroups;      /* Propagate cmsgs by affected group? */
37     bool immediatecancel;       /* Immediately cancel timecaf messages? */
38     long linecountfuzz;         /* Check linecount and reject if off by more */
39     long maxartsize;            /* Reject articles bigger than this */
40     long maxconnections;        /* Max number of incoming NNTP connections */
41     char *pathalias;            /* Prepended Host for the Path line */
42     char *pathcluster;          /* Appended Host for the Path line */
43     bool pgpverify;             /* Verify control messages with pgpverify? */
44     long port;                  /* Which port innd should listen on */
45     bool refusecybercancels;    /* Reject message IDs with "<cancel."? */
46     bool remembertrash;         /* Put unwanted article IDs into history */
47     char *sourceaddress;        /* Source IP for outgoing NNTP connections */
48     char *sourceaddress6;       /* Source IPv6 for outgoing NNTP connections */
49     bool verifycancels;         /* Verify cancels against article author */
50     bool wanttrash;             /* Put unwanted articles in junk */
51     long wipcheck;              /* How long to defer other copies of article */
52     long wipexpire;             /* How long to keep pending article record */
53
54     /* History settings */
55     char *hismethod;            /* Which history method to use */
56     
57     /* Article Storage */
58     long cnfscheckfudgesize;    /* Additional CNFS integrity checking */
59     bool enableoverview;        /* Store overview info for articles? */
60     bool groupbaseexpiry;       /* Do expiry by newsgroup? */
61     bool mergetogroups;         /* Refile articles from to.* into to */
62     bool nfswriter;             /* Use NFS writer functionality */
63     long overcachesize;         /* fd size cache for tradindexed */
64     char *ovgrouppat;           /* Newsgroups to store overview for */
65     char *ovmethod;             /* Which overview method to use */
66     bool storeonxref;           /* SMstore use Xref to detemine class? */
67     bool useoverchan;           /* overchan write the overview, not innd? */
68     bool wireformat;            /* Store tradspool artilces in wire format? */
69     bool xrefslave;             /* Act as a slave of another server? */
70
71     /* Reading */
72     bool allownewnews;          /* Allow use of the NEWNEWS command */
73     bool articlemmap;           /* Use mmap to read articles? */
74     long clienttimeout;         /* How long nnrpd can be inactive */
75     long initialtimeout;        /* How long nnrpd waits for first command */
76     long msgidcachesize;        /* Number of entries in the message ID cache */
77     bool nfsreader;             /* Use NFS reader functionality */
78     long nfsreaderdelay;        /* Delay applied to article arrival */
79     bool nnrpdcheckart;         /* Check article existence before returning? */
80     char *nnrpdflags;           /* Arguments to pass when spawning nnrpd */
81     long nnrpdloadlimit;        /* Maximum getloadvg() we allow */
82     bool noreader;              /* Refuse to fork nnrpd for readers? */
83     bool readerswhenstopped;    /* Allow nnrpd when server is paused */
84     bool readertrack;           /* Use the reader tracking system? */
85     bool tradindexedmmap;       /* Whether to mmap for tradindexed */
86
87     /* Reading -- Keyword Support */
88     bool keywords;              /* Generate keywords in overview? */
89     long keyartlimit;           /* Max article size for keyword generation */
90     long keylimit;              /* Max allocated space for keywords */
91     long keymaxwords;           /* Max count of interesting works */
92
93     /* Posting */
94     bool addnntppostingdate;    /* Add NNTP-Posting-Date: to posts */
95     bool addnntppostinghost;    /* Add NNTP-Posting-Host: to posts */
96     bool checkincludedtext;     /* Reject if too much included text */
97     char *complaints;           /* Address for X-Complaints-To: */
98     char *fromhost;             /* Host for the From: line */
99     long localmaxartsize;       /* Max article size of local postings */
100     char *moderatormailer;      /* Default host to mail moderated articles */
101     bool nnrpdauthsender;       /* Add authenticated Sender: header? */
102     char *nnrpdposthost;        /* Host postings should be forwarded to */
103     long nnrpdpostport;         /* Port postings should be forwarded to */
104     char *organization;         /* Data for the Organization: header */
105     bool spoolfirst;            /* Spool all posted articles? */
106     bool strippostcc;           /* Strip To:, Cc: and Bcc: from posts */
107
108     /* Posting -- Exponential Backoff */
109     bool backoffauth;           /* Backoff by user, not IP address */
110     char *backoffdb;            /* Directory for backoff databases */
111     long backoffk;              /* Multiple for the sleep time */
112     long backoffpostfast;       /* Upper time limit for fast posting */
113     long backoffpostslow;       /* Lower time limit for slow posting */
114     long backofftrigger;        /* Number of postings before triggered */
115
116     /* Monitoring */
117     bool doinnwatch;            /* Start innwatch from rc.news? */
118     long innwatchbatchspace;    /* Minimum free space in pathoutgoing */
119     long innwatchlibspace;      /* Minimum free space in pathdb */
120     long innwatchloload;        /* Load times 100 at which to restart */
121     long innwatchhiload;        /* Load times 100 at which to throttle */
122     long innwatchpauseload;     /* Load times 100 at which to pause */
123     long innwatchsleeptime;     /* Seconds to wait between checks */
124     long innwatchspoolnodes;    /* Minimum free inodes in patharticles */
125     long innwatchspoolspace;    /* Minimum free space in patharticles */
126
127     /* Logging */
128     bool docnfsstat;            /* Run cnfsstat in the background? */
129     bool logartsize;            /* Log article sizes? */
130     bool logcancelcomm;         /* Log ctlinnd cancel commands to syslog? */
131     long logcycles;             /* How many old logs scanlogs should keep */
132     bool logipaddr;             /* Log by host IP address? */
133     bool logsitename;           /* Log outgoing site names? */
134     bool nnrpdoverstats;        /* Log overview statistics? */
135     long nntpactsync;           /* Checkpoint log after this many articles */
136     bool nntplinklog;           /* Put storage token into the log? */
137     long status;                /* Status file update interval */
138     long timer;                 /* Performance monitoring interval */
139     char *stathist;             /* Filename for history profiler outputs */
140
141     /* System Tuning */
142     long badiocount;            /* Failure count before dropping channel */
143     long blockbackoff;          /* Multiplier for sleep in EAGAIN writes */
144     long chaninacttime;         /* Wait before noticing inactive channels */
145     long chanretrytime;         /* How long before channel restarts */
146     long icdsynccount;          /* Articles between active & history updates */
147     long keepmmappedthreshold;  /* Threshold for keeping mmap in buffindexed */
148     long maxforks;              /* Give up after this many fork failure */
149     long nicekids;              /* Child processes get niced to this */
150     long nicenewnews;           /* If NEWNEWS command is used, nice to this */
151     long nicennrpd;             /* nnrpd is niced to this */
152     long pauseretrytime;        /* Seconds before seeing if pause is ended */
153     long peertimeout;           /* How long peers can be inactive */
154     long rlimitnofile;          /* File descriptor limit to set */
155     long maxcmdreadsize;        /* max NNTP command read size used by innd */
156     long datamovethreshold;     /* threshold no to extend buffer for ever */
157
158     /* Paths */
159     char *patharchive;          /* Archived news. */
160     char *patharticles;         /* Articles. */
161     char *pathbin;              /* News binaries. */
162     char *pathcontrol;          /* Path to control message handlers */
163     char *pathdb;               /* News database files */
164     char *pathetc;              /* News configuration files */
165     char *pathfilter;           /* Filtering code */
166     char *pathhttp;             /* HTML files */
167     char *pathincoming;         /* Incoming spooled news */
168     char *pathlog;              /* Log files */
169     char *pathnews;             /* Home directory for news user */
170     char *pathoutgoing;         /* Outgoing news batch files */
171     char *pathoverview;         /* Overview infomation */
172     char *pathrun;              /* Runtime state and sockets */
173     char *pathspool;            /* Root of news spool hierarchy */
174     char *pathtmp;              /* Temporary files for the news system */
175 };
176
177 /* The global innconf variable used in programs. */
178 extern struct innconf *innconf;
179
180 /* Used to request various types of quoting when printing out values. */
181 enum innconf_quoting {
182     INNCONF_QUOTE_NONE,
183     INNCONF_QUOTE_SHELL,
184     INNCONF_QUOTE_PERL,
185     INNCONF_QUOTE_TCL
186 };
187
188 BEGIN_DECLS
189
190 /* Parse the given file into innconf, using the default path if NULL. */
191 bool innconf_read(const char *path);
192
193 /* Free an innconf struct and all allocated memory for it. */
194 void innconf_free(struct innconf *);
195
196 /* Print a single value with appropriate quoting, return whether found. */
197 bool innconf_print_value(FILE *, const char *key, enum innconf_quoting);
198
199 /* Dump the entire configuration with appropriate quoting. */
200 void innconf_dump(FILE *, enum innconf_quoting);
201
202 /* Compare two instances of an innconf struct, for testing. */
203 bool innconf_compare(struct innconf *, struct innconf *);
204
205 /* Check the validity of an inn.conf file.  Does innconf_read plus checking
206    for any unknown parameters that are set. */
207 bool innconf_check(const char *path);
208
209 END_DECLS
210
211 #endif /* INN_INNCONF_H */