4 * Main Citadel header file
6 * Copyright (c) 1987-2010 by the citadel.org team
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 3 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 /* system customizations are in sysconfig.h */
27 /* #include <dmalloc.h> uncomment if using dmalloc */
31 #include "sysconfig.h"
40 * Text description of this software
41 * (We used to define this ourselves, but why bother when
42 * the GNU build tools do it for us?)
44 #define CITADEL PACKAGE_STRING
47 * REV_LEVEL is the current version number (multiplied by 100 to avoid having
48 * to fiddle with the decimal). REV_MIN is the oldest version of Citadel
49 * whose data files are compatible with the current version. If the data files
50 * are older than REV_MIN, none of the programs will work until the setup
51 * program is run again to bring things up to date. EXPORT_REV_MIN is the
52 * oldest version of Citadel whose export files we can read. The latter is
53 * usually more strict because you're not really supposed to dump/load and
54 * upgrade at the same time.
56 #define REV_LEVEL 786 /* This version */
57 #define REV_MIN 591 /* Oldest compatible database */
58 #define EXPORT_REV_MIN 760 /* Oldest compatible export files */
59 #define LIBCITADEL_MIN 786 /* Minimum required version of libcitadel */
61 #define SERVER_TYPE 0 /* zero for stock Citadel; other developers please
62 obtain SERVER_TYPE codes for your implementations */
64 #ifdef LIBCITADEL_VERSION_NUMBER
65 #if LIBCITADEL_VERSION_NUMBER < LIBCITADEL_MIN
66 #error libcitadel is too old. Please upgrade it before continuing.
70 /* Various length constants */
72 #define UGLISTLEN 100 /* you get a ungoto list of this size */
73 #define ROOMNAMELEN 128 /* The size of a roomname string */
74 #define NONCE_SIZE 128 /* Added by <bc> to allow for APOP auth
75 * it is BIG becuase there is a hostname
76 * in the nonce, as per the APOP RFC.
79 #define USERNAME_SIZE 64 /* The size of a username string */
80 #define MAX_EDITORS 5 /* # of external editors supported */
81 /* MUST be at least 1 */
84 * Message expiration policy stuff
86 typedef struct ExpirePolicy ExpirePolicy;
89 #include "datadefinitions.h"
90 #include "dtds/expirepolicy-defs.h"
91 #include "undef_data.h"
97 #define EXPIRE_NEXTLEVEL 0 /* Inherit expiration policy */
98 #define EXPIRE_MANUAL 1 /* Don't expire messages at all */
99 #define EXPIRE_NUMMSGS 2 /* Keep only latest n messages */
100 #define EXPIRE_AGE 3 /* Expire messages after n days */
104 * This struct stores a list of rooms with new messages which the client
105 * fetches from the server. This allows the client to "march" through
106 * relevant rooms without having to ask the server each time where to go next.
108 typedef struct march march;
111 #include "datadefinitions.h"
112 #include "dtds/march-defs.h"
113 #include "undef_data.h"
116 char march_name[ROOMNAMELEN];
117 unsigned int march_flags;
120 unsigned int march_flags2;
124 #define NODENAME config.c_nodename
125 #define FQDN config.c_fqdn
126 #define HUMANNODE config.c_humannode
127 #define PHONENUM config.c_phonenum
128 #define CTDLUID config.c_ctdluid
129 #define CREATAIDE config.c_creataide
130 #define REGISCALL config.c_regiscall
131 #define TWITDETECT config.c_twitdetect
132 #define TWITROOM config.c_twitroom
133 #define RESTRICT_INTERNET config.c_restrict
138 typedef struct ctdluser ctdluser;
139 struct ctdluser { /* User record */
141 #include "datadefinitions.h"
142 #include "dtds/user-defs.h"
143 #include "undef_data.h"
145 int version; /* Cit vers. which created this rec */
146 uid_t uid; /* Associate with a unix account? */
147 char password[32]; /* password */
148 unsigned flags; /* See US_ flags below */
149 long timescalled; /* Total number of logins */
150 long posted; /* Number of messages ever submitted */
151 cit_uint8_t axlevel; /* Access level */
152 long usernum; /* User number (never recycled) */
153 time_t lastcall; /* Date/time of most recent login */
154 int USuserpurge; /* Purge time (in days) for user */
155 char fullname[64]; /* Display name (primary identifier) */
156 cit_uint8_t USscreenwidth; /* Screen width (for textmode users) */
157 cit_uint8_t USscreenheight; /* Screen height(for textmode users) */
161 /* Bits which may appear in CitControl.MMflags. Note that these don't
162 * necessarily pertain to the message base -- it's just a good place to
163 * store any global flags.
165 #define MM_VALID 4 /* New users need validating */
170 typedef struct ctdlroom ctdlroom;
173 #include "datadefinitions.h"
174 #include "dtds/room-defs.h"
175 #include "undef_data.h"
177 char QRname[ROOMNAMELEN]; /* Name of room */
178 char QRpasswd[10]; /* Only valid if it's a private rm */
179 long QRroomaide; /* User number of room aide */
180 long QRhighest; /* Highest message NUMBER in room */
181 time_t QRgen; /* Generation number of room */
182 unsigned QRflags; /* See flag values below */
183 char QRdirname[15]; /* Directory name, if applicable */
184 long QRinfo; /* Info file update relative to msgs*/
185 char QRfloor; /* Which floor this room is on */
186 time_t QRmtime; /* Date/time of last post */
187 struct ExpirePolicy QRep; /* Message expiration policy */
188 long QRnumber; /* Globally unique room number */
189 char QRorder; /* Sort key for room listing order */
190 unsigned QRflags2; /* Additional flags */
191 int QRdefaultview; /* How to display the contents */
194 /* Private rooms are always flagged with QR_PRIVATE. If neither QR_PASSWORDED
195 * or QR_GUESSNAME is set, then it is invitation-only. Passworded rooms are
196 * flagged with both QR_PRIVATE and QR_PASSWORDED while guess-name rooms are
197 * flagged with both QR_PRIVATE and QR_GUESSNAME. NEVER set all three flags.
203 #define MES_NORMAL 65 /* Normal message */
204 #define MES_ANONONLY 66 /* "****" header */
205 #define MES_ANONOPT 67 /* "Anonymous" header */
207 #define MES_ERROR (-1) /* Can't send message due to bad address */
208 #define MES_LOCAL 0 /* Local message, do no network processing */
209 #define MES_INTERNET 1 /* Convert msg and send as Internet mail */
210 #define MES_IGNET 2 /* Process recipient and send via Cit net */
212 /****************************************************************************/
215 * Floor record. The floor number is implicit in its location in the file.
217 typedef struct floor floor;
220 #include "datadefinitions.h"
221 #include "dtds/floor-defs.h"
222 #include "undef_data.h"
224 unsigned short f_flags; /* flags */
225 char f_name[256]; /* name of floor */
226 int f_ref_count; /* reference count */
227 struct ExpirePolicy f_ep; /* default expiration policy */
230 #define F_INUSE 1 /* floor is in use */
234 * Values used internally for function call returns, etc.
237 #define NEWREGISTER 0 /* new user to register */
238 #define REREGISTER 1 /* existing user reregistering */
240 #define READ_HEADER 2
241 #define READ_MSGBODY 3
243 /* commands we can send to the stty_ctdl() routine */
244 #define SB_NO_INTR 0 /* set to Citadel client mode, i/q disabled */
245 #define SB_YES_INTR 1 /* set to Citadel client mode, i/q enabled */
246 #define SB_SAVE 2 /* save settings */
247 #define SB_RESTORE 3 /* restore settings */
248 #define SB_LAST 4 /* redo the last command sent */
253 /* server exit codes */
254 #define EXIT_NORMAL 0 /* server terminated normally */
255 /* 1 through 63 reserved for signals */
256 #define EXIT_NULL 64 /* EOF on server command input */
258 /* citadel.rc stuff */
259 #define RC_NO 0 /* always no */
260 #define RC_YES 1 /* always yes */
261 #define RC_DEFAULT 2 /* setting depends on user config */
265 KA_NO, /* no keepalives */
266 KA_YES, /* full keepalives */
267 KA_HALF /* half keepalives */
270 /* for <;G>oto and <;S>kip commands */
271 #define GF_GOTO 0 /* <;G>oto floor mode */
272 #define GF_SKIP 1 /* <;S>kip floor mode */
273 #define GF_ZAP 2 /* <;Z>ap floor mode */
276 * MIME types used in Citadel for configuration stuff
278 #define SPOOLMIME "application/x-citadel-delivery-list"
279 #define INTERNETCFG "application/x-citadel-internet-config"
280 #define IGNETCFG "application/x-citadel-ignet-config"
281 #define IGNETMAP "application/x-citadel-ignet-map"
282 #define FILTERLIST "application/x-citadel-filter-list"
283 #define SIEVECONFIG "application/x-citadel-sieve-config"
284 #define XMPPMORTUARY "application/x-citadel-xmpp-mortuary"
286 #define TRACE CtdlLogPrintf(CTDL_DEBUG, "Checkpoint: %s, %d\n", __FILE__, __LINE__)
289 #define LONG_MAX 2147483647L
293 * Authentication modes
295 #define AUTHMODE_NATIVE 0 /* Native (self-contained or "black box") */
296 #define AUTHMODE_HOST 1 /* Authenticate against the host OS user database */
297 #define AUTHMODE_LDAP 2 /* Authenticate against an LDAP server with RFC 2307 schema */
298 #define AUTHMODE_LDAP_AD 3 /* Authenticate against non-standard MS Active Directory LDAP */
304 #endif /* CITADEL_H */