4 * main Citadel/UX header file
5 * see copyright.txt for copyright information
8 /* system customizations are in sysconfig.h */
15 #include "sysconfig.h"
23 * Text description of this software
25 #define CITADEL "Citadel/UX 6.01"
28 * REV_LEVEL is the current version number (multiplied by 100 to avoid having
29 * to fiddle with the decimal). REV_MIN is the oldest version of Citadel
30 * whose data files are compatible with the current version. If the data files
31 * are older than REV_MIN, none of the programs will work until the setup
32 * program is run again to bring things up to date.
34 #define REV_LEVEL 601 /* This version */
35 #define REV_MIN 591 /* Oldest compatible version */
37 #define SERVER_TYPE 0 /* zero for stock Citadel/UX; other developers please
38 obtain SERVER_TYPE codes for your implementations */
41 * This is a better implementation of tolower() than that found on some
42 * systems (there are operating systems out there on which tolower() will
43 * screw up if you give it a character that is already lower case).
48 #define tolower(x) ( ((x>='A')&&(x<='Z')) ? (x+'a'-'A') : x )
52 * The only typedef we do is an 8-bit unsigned, for screen dimensions.
53 * All other defs are done using standard C types. The code assumes that
54 * 'int' 'unsigned' and 'short' are at least 16 bits, and that 'long' is at
55 * least 32 bits. There are no endian dependencies in any of the Citadel
58 typedef unsigned char CIT_UBYTE;
60 /* Various length constants */
62 #define UGLISTLEN 100 /* you get a ungoto list of this size */
63 #define ROOMNAMELEN 128 /* The size of a roomname string */
64 #define NONCE_SIZE 128 /* Added by <bc> to allow for APOP auth
65 * it is BIG becuase there is a hostname
66 * in the nonce, as per the APOP RFC.
69 #define USERNAME_SIZE 32 /* The size of a username string */
72 * Message expiration policy stuff
79 #define EXPIRE_NEXTLEVEL 0 /* Inherit expiration policy */
80 #define EXPIRE_MANUAL 1 /* Don't expire messages at all */
81 #define EXPIRE_NUMMSGS 2 /* Keep only latest n messages */
82 #define EXPIRE_AGE 3 /* Expire messages after n days */
86 * Global system configuration
89 char c_nodename[16]; /* Unqualified "short" nodename */
90 char c_fqdn[64]; /* Fully Qualified Domain Name */
91 char c_humannode[21]; /* Long name of system */
92 char c_phonenum[16]; /* Dialup number of system */
93 uid_t c_bbsuid; /* UID of the bbs-only user */
94 char c_creataide; /* room creator = room aide flag */
95 int c_sleeping; /* watchdog timer setting */
96 char c_initax; /* initial access level */
97 char c_regiscall; /* call number to register on */
98 char c_twitdetect; /* twit detect flag */
99 char c_twitroom[ROOMNAMELEN]; /* twit detect msg move to room */
100 char c_moreprompt[80]; /* paginator prompt */
101 char c_restrict; /* restrict Internet mail flag */
102 long c_msgbase; /* size of message base (obsolete) */
103 char c_bbs_city[32]; /* physical location of server */
104 char c_sysadm[26]; /* name of system administrator */
105 char c_bucket_dir[15]; /* bit bucket for files... */
106 int c_setup_level; /* what rev level we've setup to */
107 int c_maxsessions; /* maximum concurrent sessions */
108 char c_net_password[20]; /* system net password (obsolete) */
109 int c_port_number; /* Cit listener port (usually 504) */
110 int c_ipgm_secret; /* Internal program authentication */
111 struct ExpirePolicy c_ep; /* System default msg expire policy */
112 int c_userpurge; /* System default user purge (days) */
113 int c_roompurge; /* System default room purge (days) */
114 char c_logpages[ROOMNAMELEN]; /* Room to log pages to (or not) */
115 char c_createax; /* Axlevel required to create rooms */
116 long c_maxmsglen; /* Maximum message length */
117 int c_min_workers; /* Lower limit on number of threads */
118 int c_max_workers; /* Upper limit on number of threads */
119 int c_pop3_port; /* POP3 listener port (usually 110) */
120 int c_smtp_port; /* SMTP listener port (usually 25) */
121 int c_unused_1; /* Nothin' here anymore... */
122 int c_aide_zap; /* Are Aides allowed to zap rooms? */
123 int c_imap_port; /* IMAP listener port (usually 143) */
124 time_t c_net_freq; /* how often to run the networker */
125 char c_disable_newu; /* disable NEWU command */
126 char c_aide_mailboxes; /* give Aides access to mailboxes */
127 char c_baseroom[ROOMNAMELEN]; /* Name of baseroom (Lobby) */
128 char c_aideroom[ROOMNAMELEN]; /* Name of aideroom (Aide) */
133 char march_name[ROOMNAMELEN];
134 unsigned int march_flags;
139 #define NODENAME config.c_nodename
140 #define FQDN config.c_fqdn
141 #define HUMANNODE config.c_humannode
142 #define PHONENUM config.c_phonenum
143 #define BBSUID config.c_bbsuid
144 #define CREATAIDE config.c_creataide
145 #define REGISCALL config.c_regiscall
146 #define TWITDETECT config.c_twitdetect
147 #define TWITROOM config.c_twitroom
148 #define RESTRICT_INTERNET config.c_restrict
150 /* Defines the actual user record */
152 struct usersupp { /* User record */
153 int version; /* Cit vers. which created this rec */
154 uid_t uid; /* Associate with a unix account? */
155 char password[32]; /* password (for BBS-only users) */
156 unsigned flags; /* See US_ flags below */
157 long timescalled; /* Total number of logins */
158 long posted; /* Number of messages posted (ever) */
159 CIT_UBYTE axlevel; /* Access level */
160 long usernum; /* User number (never recycled) */
161 time_t lastcall; /* Last time the user called */
162 int USuserpurge; /* Purge time (in days) for user */
163 char fullname[64]; /* Name for Citadel messages & mail */
164 CIT_UBYTE USscreenwidth; /* Screen width (for textmode users)*/
165 CIT_UBYTE USscreenheight; /* Screen height(for textmode users)*/
170 * This is the control record for the message base...
173 long MMhighest; /* highest message number in file */
174 unsigned MMflags; /* Global system flags */
175 long MMnextuser; /* highest user number on system */
176 long MMnextroom; /* highest room number on system */
177 int version; /* Server-hosted upgrade level */
180 /* Bits which may appear in CitControl.MMflags. Note that these don't
181 * necessarily pertain to the message base -- it's just a good place to
182 * store any global flags.
184 #define MM_VALID 4 /* New users need validating */
190 char QRname[ROOMNAMELEN]; /* Name of room */
191 char QRpasswd[10]; /* Only valid if it's a private rm */
192 long QRroomaide; /* User number of room aide */
193 long QRhighest; /* Highest message NUMBER in room */
194 time_t QRgen; /* Generation number of room */
195 unsigned QRflags; /* See flag values below */
196 char QRdirname[15]; /* Directory name, if applicable */
197 long QRinfo; /* Info file update relative to msgs*/
198 char QRfloor; /* Which floor this room is on */
199 time_t QRmtime; /* Date/time of last post */
200 struct ExpirePolicy QRep; /* Message expiration policy */
201 long QRnumber; /* Globally unique room number */
202 char QRorder; /* Sort key for room listing order */
203 unsigned QRflags2; /* Additional flags */
204 int QRdefaultview; /* How to display the contents */
207 /* Private rooms are always flagged with QR_PRIVATE. If neither QR_PASSWORDED
208 * or QR_GUESSNAME is set, then it is invitation-only. Passworded rooms are
209 * flagged with both QR_PRIVATE and QR_PASSWORDED while guess-name rooms are
210 * flagged with both QR_PRIVATE and QR_GUESSNAME. NEVER set all three flags.
214 * Events which might show up in the Citadel Log
216 #define CL_CONNECT 8 /* Connect to server */
217 #define CL_LOGIN 16 /* CLfullname logged in */
218 #define CL_NEWUSER 32 /* CLfullname is a new user */
219 #define CL_BADPW 64 /* Bad attempt at CLfullname's pw */
220 #define CL_TERMINATE 128 /* Logout - proper termination */
221 #define CL_DROPCARR 256 /* Logout - dropped carrier */
222 #define CL_SLEEPING 512 /* Logout - sleeping */
223 #define CL_PWCHANGE 1024 /* CLfullname changed passwords */
227 #define MES_NORMAL 65 /* Normal message */
228 #define MES_ANONONLY 66 /* "****" header */
229 #define MES_ANONOPT 67 /* "Anonymous" header */
231 #define MES_ERROR (-1) /* Can't send message due to bad address */
232 #define MES_LOCAL 0 /* Local message, do no network processing */
233 #define MES_INTERNET 1 /* Convert msg and send as Internet mail */
234 #define MES_IGNET 2 /* Process recipient and send via Cit net */
236 /****************************************************************************/
239 * Floor record. The floor number is implicit in its location in the file.
242 unsigned short f_flags; /* flags */
243 char f_name[256]; /* name of floor */
244 int f_ref_count; /* reference count */
245 struct ExpirePolicy f_ep; /* default expiration policy */
248 #define F_INUSE 1 /* floor is in use */
252 * Values used internally for function call returns, etc.
255 #define NEWREGISTER 0 /* new user to register */
256 #define REREGISTER 1 /* existing user reregistering */
258 #define READ_HEADER 2
259 #define READ_MSGBODY 3
261 /* commands we can send to the sttybbs() routine */
262 #define SB_NO_INTR 0 /* set to bbs mode, i/q disabled */
263 #define SB_YES_INTR 1 /* set to bbs mode, i/q enabled */
264 #define SB_SAVE 2 /* save settings */
265 #define SB_RESTORE 3 /* restore settings */
266 #define SB_LAST 4 /* redo the last command sent */
271 /* server exit codes */
272 #define EXIT_NORMAL 0 /* server terminated normally */
273 /* 1 through 63 reserved for signals */
274 #define EXIT_NULL 64 /* EOF on server command input */
276 /* citadel.rc stuff */
277 #define RC_NO 0 /* always no */
278 #define RC_YES 1 /* always yes */
279 #define RC_DEFAULT 2 /* setting depends on user config */
283 KA_NO, /* no keepalives */
284 KA_YES, /* full keepalives */
285 KA_HALF /* half keepalives */
288 /* for <;G>oto and <;S>kip commands */
289 #define GF_GOTO 0 /* <;G>oto floor mode */
290 #define GF_SKIP 1 /* <;S>kip floor mode */
291 #define GF_ZAP 2 /* <;Z>ap floor mode */
294 * MIME types used in Citadel for configuration stuff
296 #define SPOOLMIME "application/x-citadel-delivery-list"
297 #define INTERNETCFG "application/x-citadel-internet-config"
298 #define IGNETCFG "application/x-citadel-ignet-config"
299 #define IGNETMAP "application/x-citadel-ignet-map"
300 #define FILTERLIST "application/x-citadel-filter-list"
301 #define SPAMSTRINGS "application/x-citadel-spam-strings"
303 #define TRACE lprintf(9, "Checkpoint: %s, %d\n", __FILE__, __LINE__)
306 #define LONG_MAX 2147483647L
313 #define VIEW_BBS 0 /* Traditional Citadel BBS view */
314 #define VIEW_MAILBOX 1 /* Mailbox summary */
315 #define VIEW_ADDRESSBOOK 2 /* Address book view */
324 #define tmpnam(x) CtdlTempFileName(__FILE__, __LINE__)
329 #define tmpfile() CtdlTempFile()
331 #endif /* CITADEL_H */