make configure.ac automagically do the right thing on redhat 9
[citadel.git] / citadel / citadel.h
1 /*
2  * $Id$
3  *
4  * main Citadel/UX header file
5  * see copyright.txt for copyright information
6  */
7
8 /* system customizations are in sysconfig.h */
9
10 #ifndef CITADEL_H
11 #define CITADEL_H
12
13 /* Build Citadel with the calendar service only if the header *and*
14  * library for libical are both present.
15  */
16 #ifdef HAVE_LIBICAL
17 #ifdef HAVE_ICAL_H
18 #define CITADEL_WITH_CALENDAR_SERVICE 1
19 #endif
20 #endif
21
22 #include "sysdep.h"
23 #include <limits.h>
24 #include "sysconfig.h"
25 #include "typesize.h"
26 #include "ipcdef.h"
27
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31
32 /*
33  * Text description of this software
34  */
35 #define CITADEL "Citadel/UX 6.06"
36
37 /*
38  * REV_LEVEL is the current version number (multiplied by 100 to avoid having
39  * to fiddle with the decimal).  REV_MIN is the oldest version of Citadel
40  * whose data files are compatible with the current version.  If the data files
41  * are older than REV_MIN, none of the programs will work until the setup
42  * program is run again to bring things up to date.
43  */
44 #define REV_LEVEL       606             /* This version */
45 #define REV_MIN         591             /* Oldest compatible version */
46
47 #define SERVER_TYPE 0   /* zero for stock Citadel/UX; other developers please
48                            obtain SERVER_TYPE codes for your implementations */
49
50 #define NEW_CONFIG
51
52 /* Various length constants */
53
54 #define UGLISTLEN   100   /* you get a ungoto list of this size */
55 #define ROOMNAMELEN     128             /* The size of a roomname string */
56 #define NONCE_SIZE      128             /* Added by <bc> to allow for APOP auth 
57                                          * it is BIG becuase there is a hostname
58                                          * in the nonce, as per the APOP RFC.
59                                          */
60                                          
61 #define USERNAME_SIZE   64              /* The size of a username string */
62 #define MAX_EDITORS     5               /* # of external editors supported */
63                                         /* MUST be at least 1 */
64
65 /*
66  * Message expiration policy stuff
67  */
68 struct ExpirePolicy {
69         int expire_mode;
70         int expire_value;
71 };
72
73 #define EXPIRE_NEXTLEVEL        0       /* Inherit expiration policy    */
74 #define EXPIRE_MANUAL           1       /* Don't expire messages at all */
75 #define EXPIRE_NUMMSGS          2       /* Keep only latest n messages  */
76 #define EXPIRE_AGE              3       /* Expire messages after n days */
77
78
79 /* 
80  * Global system configuration 
81  */
82 struct config {
83         char c_nodename[16];            /* Unqualified "short" nodename     */
84         char c_fqdn[64];                /* Fully Qualified Domain Name      */
85         char c_humannode[21];           /* Long name of system              */
86         char c_phonenum[16];            /* Dialup number of system          */
87         uid_t c_bbsuid;                 /* UID of the bbs-only user         */
88         char c_creataide;               /* room creator = room aide  flag   */
89         int c_sleeping;                 /* watchdog timer setting           */
90         char c_initax;                  /* initial access level             */
91         char c_regiscall;               /* call number to register on       */
92         char c_twitdetect;              /* twit detect flag                 */
93         char c_twitroom[ROOMNAMELEN];   /* twit detect msg move to room     */
94         char c_moreprompt[80];          /* paginator prompt                 */
95         char c_restrict;                /* restrict Internet mail flag      */
96         long c_msgbase;                 /* size of message base (obsolete)  */
97         char c_bbs_city[32];            /* physical location of server      */
98         char c_sysadm[26];              /* name of system administrator     */
99         char c_bucket_dir[15];          /* bit bucket for files...          */
100         int c_setup_level;              /* what rev level we've setup to    */
101         int c_maxsessions;              /* maximum concurrent sessions      */
102         char c_net_password[20];        /* system net password (obsolete)   */
103         int c_port_number;              /* Cit listener port (usually 504)  */
104         int c_ipgm_secret;              /* Internal program authentication  */
105         struct ExpirePolicy c_ep;       /* System default msg expire policy */
106         int c_userpurge;                /* System default user purge (days) */
107         int c_roompurge;                /* System default room purge (days) */
108         char c_logpages[ROOMNAMELEN];   /* Room to log pages to (or not)    */
109         char c_createax;                /* Axlevel required to create rooms */
110         long c_maxmsglen;               /* Maximum message length           */
111         int c_min_workers;              /* Lower limit on number of threads */
112         int c_max_workers;              /* Upper limit on number of threads */
113         int c_pop3_port;                /* POP3 listener port (usually 110) */
114         int c_smtp_port;                /* SMTP listener port (usually 25)  */
115         int c_rfc822_strict_from;       /* 1 = don't correct From: forgeries*/
116         int c_aide_zap;                 /* Are Aides allowed to zap rooms?  */
117         int c_imap_port;                /* IMAP listener port (usually 143) */
118         time_t c_net_freq;              /* how often to run the networker   */
119         char c_disable_newu;            /* disable NEWU command             */
120         char c_aide_mailboxes;          /* give Aides access to mailboxes   */
121         char c_baseroom[ROOMNAMELEN];   /* Name of baseroom (Lobby)         */
122         char c_aideroom[ROOMNAMELEN];   /* Name of aideroom (Aide)          */
123 };
124
125 struct march {
126         struct march *next;
127         char march_name[ROOMNAMELEN];
128         unsigned int march_flags;
129         char march_floor;
130         char march_order;
131         unsigned int march_flags2;
132         int march_access;
133 };
134
135 #define NODENAME                config.c_nodename
136 #define FQDN                    config.c_fqdn
137 #define HUMANNODE               config.c_humannode
138 #define PHONENUM                config.c_phonenum
139 #define BBSUID                  config.c_bbsuid
140 #define CREATAIDE               config.c_creataide
141 #define REGISCALL               config.c_regiscall
142 #define TWITDETECT              config.c_twitdetect
143 #define TWITROOM                config.c_twitroom
144 #define RESTRICT_INTERNET       config.c_restrict
145
146 /* Defines the actual user record */
147  
148 struct usersupp {                       /* User record                      */
149         int version;                    /* Cit vers. which created this rec */
150         uid_t uid;                      /* Associate with a unix account?   */
151         char password[32];              /* password (for BBS-only users)    */
152         unsigned flags;                 /* See US_ flags below              */
153         long timescalled;               /* Total number of logins           */
154         long posted;                    /* Number of messages posted (ever) */
155         cit_uint8_t axlevel;            /* Access level                     */
156         long usernum;                   /* User number (never recycled)     */
157         time_t lastcall;                /* Last time the user called        */
158         int USuserpurge;                /* Purge time (in days) for user    */
159         char fullname[64];              /* Name for Citadel messages & mail */
160         cit_uint8_t USscreenwidth;      /* Screen width (for textmode users)*/
161         cit_uint8_t USscreenheight;     /* Screen height(for textmode users)*/
162 };
163
164
165 /*
166  * This is the control record for the message base... 
167  */
168 struct CitControl {
169         long MMhighest;                 /* highest message number in file   */
170         unsigned MMflags;               /* Global system flags              */
171         long MMnextuser;                /* highest user number on system    */
172         long MMnextroom;                /* highest room number on system    */
173         int version;                    /* Server-hosted upgrade level      */
174 };
175
176 /* Bits which may appear in CitControl.MMflags.  Note that these don't
177  * necessarily pertain to the message base -- it's just a good place to
178  * store any global flags.
179  */
180 #define MM_VALID        4               /* New users need validating        */
181
182 /*
183  * Room records
184  */
185 struct quickroom {
186         char QRname[ROOMNAMELEN];       /* Name of room                     */
187         char QRpasswd[10];              /* Only valid if it's a private rm  */
188         long QRroomaide;                /* User number of room aide         */
189         long QRhighest;                 /* Highest message NUMBER in room   */
190         time_t QRgen;                   /* Generation number of room        */
191         unsigned QRflags;               /* See flag values below            */
192         char QRdirname[15];             /* Directory name, if applicable    */
193         long QRinfo;                    /* Info file update relative to msgs*/
194         char QRfloor;                   /* Which floor this room is on      */
195         time_t QRmtime;                 /* Date/time of last post           */
196         struct ExpirePolicy QRep;       /* Message expiration policy        */
197         long QRnumber;                  /* Globally unique room number      */
198         char QRorder;                   /* Sort key for room listing order  */
199         unsigned QRflags2;              /* Additional flags                 */
200         int QRdefaultview;              /* How to display the contents      */
201 };
202
203 /* Private rooms are always flagged with QR_PRIVATE.  If neither QR_PASSWORDED
204  * or QR_GUESSNAME is set, then it is invitation-only.  Passworded rooms are
205  * flagged with both QR_PRIVATE and QR_PASSWORDED while guess-name rooms are
206  * flagged with both QR_PRIVATE and QR_GUESSNAME.  NEVER set all three flags.
207  */
208
209 /*
210  * Events which might show up in the Citadel Log
211  */
212 #define CL_CONNECT      8               /* Connect to server                */
213 #define CL_LOGIN        16              /* CLfullname logged in             */
214 #define CL_NEWUSER      32              /* CLfullname is a new user         */
215 #define CL_BADPW        64              /* Bad attempt at CLfullname's pw   */
216 #define CL_TERMINATE    128             /* Logout - proper termination      */
217 #define CL_DROPCARR     256             /* Logout - dropped carrier         */
218 #define CL_SLEEPING     512             /* Logout - sleeping                */
219 #define CL_PWCHANGE     1024            /* CLfullname changed passwords     */
220
221 /* Miscellaneous                                                            */
222
223 #define MES_NORMAL      65              /* Normal message                   */
224 #define MES_ANONONLY    66              /* "****" header                    */
225 #define MES_ANONOPT     67              /* "Anonymous" header               */
226
227 #define MES_ERROR       (-1)    /* Can't send message due to bad address   */
228 #define MES_LOCAL       0       /* Local message, do no network processing */
229 #define MES_INTERNET    1       /* Convert msg and send as Internet mail   */
230 #define MES_IGNET       2       /* Process recipient and send via Cit net  */
231
232 /****************************************************************************/
233
234 /*
235  * Floor record.  The floor number is implicit in its location in the file.
236  */
237 struct floor {
238         unsigned short f_flags;         /* flags */
239         char f_name[256];               /* name of floor */
240         int f_ref_count;                /* reference count */
241         struct ExpirePolicy f_ep;       /* default expiration policy */
242         };
243
244 #define F_INUSE         1               /* floor is in use */
245
246
247 /*
248  * Values used internally for function call returns, etc.
249  */
250
251 #define NEWREGISTER     0               /* new user to register */
252 #define REREGISTER      1               /* existing user reregistering */
253
254 #define READ_HEADER     2
255 #define READ_MSGBODY    3
256
257 /* commands we can send to the sttybbs() routine */
258 #define SB_NO_INTR      0               /* set to bbs mode, i/q disabled */
259 #define SB_YES_INTR     1               /* set to bbs mode, i/q enabled */
260 #define SB_SAVE         2               /* save settings */
261 #define SB_RESTORE      3               /* restore settings */
262 #define SB_LAST         4               /* redo the last command sent */
263
264 #define NEXT_KEY        15
265 #define STOP_KEY        3
266
267 /* server exit codes */
268 #define EXIT_NORMAL     0               /* server terminated normally */
269                                         /* 1 through 63 reserved for signals */
270 #define EXIT_NULL       64              /* EOF on server command input */
271
272 /* citadel.rc stuff */
273 #define RC_NO           0               /* always no */
274 #define RC_YES          1               /* always yes */
275 #define RC_DEFAULT      2               /* setting depends on user config */
276
277 /* keepalives */
278 enum {
279         KA_NO,                          /* no keepalives */
280         KA_YES,                         /* full keepalives */
281         KA_HALF                         /* half keepalives */
282 };
283
284 /* for <;G>oto and <;S>kip commands */
285 #define GF_GOTO         0               /* <;G>oto floor mode */
286 #define GF_SKIP         1               /* <;S>kip floor mode */
287 #define GF_ZAP          2               /* <;Z>ap floor mode */
288
289 /*
290  * MIME types used in Citadel for configuration stuff
291  */
292 #define SPOOLMIME       "application/x-citadel-delivery-list"
293 #define INTERNETCFG     "application/x-citadel-internet-config"
294 #define IGNETCFG        "application/x-citadel-ignet-config"
295 #define IGNETMAP        "application/x-citadel-ignet-map"
296 #define FILTERLIST      "application/x-citadel-filter-list"
297 #define SPAMSTRINGS     "application/x-citadel-spam-strings"
298
299 #define TRACE   lprintf(9, "Checkpoint: %s, %d\n", __FILE__, __LINE__)
300
301 #ifndef LONG_MAX
302 #define LONG_MAX 2147483647L
303 #endif
304
305
306 /*
307  * Views
308  */
309 #define VIEW_BBS                0       /* Traditional Citadel BBS view */
310 #define VIEW_MAILBOX            1       /* Mailbox summary */
311 #define VIEW_ADDRESSBOOK        2       /* Address book view */
312
313 #ifdef __cplusplus
314 }
315 #endif
316
317 #ifdef tmpnam
318 #undef tmpnam
319 #endif
320 #define tmpnam(x)       CtdlTempFileName(__FILE__, __LINE__)
321
322 #ifdef tmpfile
323 #undef tmpfile
324 #endif
325 #define tmpfile()       CtdlTempFile()
326
327 #endif /* CITADEL_H */