4 * main Citadel/UX header file
5 * see copyright.txt for copyright information
8 /* system customizations are in sysconfig.h */
10 #include "sysconfig.h"
13 #define CITADEL "Citadel/UX 5.80" /* Text description of this software */
16 * REV_LEVEL is the current version number (multiplied by 100 to avoid having
17 * to fiddle with the decimal). REV_MIN is the oldest version of Citadel
18 * whose data files are compatible with the current version. If the data files
19 * are older than REV_MIN, none of the programs will work until the setup
20 * program is run again to bring things up to date.
22 #define REV_LEVEL 580 /* This version */
23 #define REV_MIN 570 /* Oldest compatible version */
25 #define SERVER_TYPE 0 /* zero for stock Citadel/UX; other developers please
26 obtain SERVER_TYPE codes for your implementations */
29 #define tolower(x) ( ((x>='A')&&(x<='Z')) ? (x+'a'-'A') : x )
33 * The only typedef we do is an 8-bit unsigned, for screen dimensions.
34 * All other defs are done using standard C types. The code assumes that
35 * 'int' 'unsigned' and 'short' are at least 16 bits, and that 'long' is at
36 * least 32 bits. There are no endian dependencies in any of the Citadel
39 typedef unsigned char CIT_UBYTE;
41 /* Various length constants */
43 #define ROOMNAMELEN 128 /* The size of the roomname structure */
44 #define NONCE_SIZE 128 /* Added by <bc> to allow for APOP auth
45 * it is BIG becuase there is a hostname
46 * in the nonce, as per the APOP RFC.
49 #define USERNAME_SIZE 32 /* The size of a username string */
52 * Message expiration policy stuff
59 #define EXPIRE_NEXTLEVEL 0 /* Inherit expiration policy */
60 #define EXPIRE_MANUAL 1 /* Don't expire messages at all */
61 #define EXPIRE_NUMMSGS 2 /* Keep only latest n messages */
62 #define EXPIRE_AGE 3 /* Expire messages after n days */
66 * Global system configuration
69 char c_nodename[16]; /* Unqualified "short" nodename */
70 char c_fqdn[64]; /* Fully Qualified Domain Name */
71 char c_humannode[21]; /* Long name of system */
72 char c_phonenum[16]; /* Dialup number of system */
73 uid_t c_bbsuid; /* UID of the bbs-only user */
74 char c_creataide; /* room creator = room aide flag */
75 int c_sleeping; /* watchdog timer setting */
76 char c_initax; /* initial access level */
77 char c_regiscall; /* call number to register on */
78 char c_twitdetect; /* twit detect flag */
79 char c_twitroom[ROOMNAMELEN]; /* twit detect msg move to room */
80 char c_moreprompt[80]; /* paginator prompt */
81 char c_restrict; /* restrict Internet mail flag */
82 long c_msgbase; /* size of message base */
83 char c_bbs_city[32]; /* city and state you are located in*/
84 char c_sysadm[26]; /* name of system administrator */
85 char c_bucket_dir[15]; /* bit bucket for files... */
86 int c_setup_level; /* what rev level we've setup to */
87 int c_maxsessions; /* maximum concurrent sessions */
88 char c_net_password[20]; /* system net password */
89 int c_port_number; /* TCP port to run the server on */
90 int c_ipgm_secret; /* Internal program authentication */
91 struct ExpirePolicy c_ep; /* System default msg expire policy */
92 int c_userpurge; /* System default user purge (days) */
93 int c_roompurge; /* System default room purge (days) */
94 char c_logpages[ROOMNAMELEN]; /* Room to log pages to (or not) */
95 char c_createax; /* Axlevel required to create rooms */
96 long c_maxmsglen; /* Maximum message length */
97 int c_min_workers; /* Lower limit on number of threads */
98 int c_max_workers; /* Upper limit on number of threads */
99 int c_pop3_port; /* POP3 listener port (usually 110) */
100 int c_smtp_port; /* SMTP listener port (usually 25) */
101 int c_default_filter; /* Default moderation filter level */
102 int c_aide_zap; /* Are Aides allowed to zap rooms? */
103 int c_imap_port; /* IMAP listener port (usually 143) */
106 #define NODENAME config.c_nodename
107 #define FQDN config.c_fqdn
108 #define HUMANNODE config.c_humannode
109 #define PHONENUM config.c_phonenum
110 #define BBSUID config.c_bbsuid
111 #define CREATAIDE config.c_creataide
112 #define REGISCALL config.c_regiscall
113 #define TWITDETECT config.c_twitdetect
114 #define TWITROOM config.c_twitroom
115 #define RESTRICT_INTERNET config.c_restrict
117 /* Defines the actual user record */
119 struct usersupp { /* User record */
120 int version; /* Cit vers. which created this rec */
121 uid_t uid; /* Associate with a unix account? */
122 char password[32]; /* password (for BBS-only users) */
123 unsigned flags; /* See US_ flags below */
124 long timescalled; /* Total number of logins */
125 long posted; /* Number of messages posted (ever) */
126 CIT_UBYTE axlevel; /* Access level */
127 long usernum; /* User number (never recycled) */
128 time_t lastcall; /* Last time the user called */
129 int USuserpurge; /* Purge time (in days) for user */
130 char fullname[64]; /* Name for Citadel messages & mail */
131 CIT_UBYTE USscreenwidth; /* Screen width (for textmode users)*/
132 CIT_UBYTE USscreenheight; /* Screen height(for textmode users)*/
133 char moderation_filter; /* Moderation filter level */
137 /****************************************************************************
138 * This is the control record for the message base...
141 long MMhighest; /* highest message number in file */
142 unsigned MMflags; /* Global system flags */
143 long MMnextuser; /* highest user number on system */
144 long MMnextroom; /* highest room number on system */
145 int version; /* Server-hosted upgrade level */
148 /* Bits which may appear in CitControl.MMflags. Note that these don't
149 * necessarily pertain to the message base -- it's just a good place to
150 * store any global flags.
152 #define MM_VALID 4 /* New users need validating */
154 /****************************************************************************
158 char QRname[ROOMNAMELEN]; /* Name of room */
159 char QRpasswd[10]; /* Only valid if it's a private rm */
160 long QRroomaide; /* User number of room aide */
161 long QRhighest; /* Highest message NUMBER in room */
162 time_t QRgen; /* Generation number of room */
163 unsigned QRflags; /* See flag values below */
164 char QRdirname[15]; /* Directory name, if applicable */
165 long QRinfo; /* Info file update relative to msgs*/
166 char QRfloor; /* Which floor this room is on */
167 time_t QRmtime; /* Date/time of last post */
168 struct ExpirePolicy QRep; /* Message expiration policy */
169 long QRnumber; /* Globally unique room number */
170 char QRorder; /* Sort key for room listing order */
174 /* Private rooms are always flagged with QR_PRIVATE. If neither QR_PASSWORDED
175 * or QR_GUESSNAME is set, then it is invitation-only. Passworded rooms are
176 * flagged with both QR_PRIVATE and QR_PASSWORDED while guess-name rooms are
177 * flagged with both QR_PRIVATE and QR_GUESSNAME. NEVER set all three flags.
181 * Events which might show up in the Citadel Log
183 #define CL_CONNECT 8 /* Connect to server */
184 #define CL_LOGIN 16 /* CLfullname logged in */
185 #define CL_NEWUSER 32 /* CLfullname is a new user */
186 #define CL_BADPW 64 /* Bad attempt at CLfullname's pw */
187 #define CL_TERMINATE 128 /* Logout - proper termination */
188 #define CL_DROPCARR 256 /* Logout - dropped carrier */
189 #define CL_SLEEPING 512 /* Logout - sleeping */
190 #define CL_PWCHANGE 1024 /* CLfullname changed passwords */
194 #define MES_NORMAL 65 /* Normal message */
195 #define MES_ANON 66 /* "****" header */
196 #define MES_AN2 67 /* "Anonymous" header */
198 #define MES_ERROR (-1) /* Can't send message due to bad address */
199 #define MES_LOCAL 0 /* Local message, do no network processing */
200 #define MES_INTERNET 1 /* Convert msg and send as Internet mail */
201 #define MES_BINARY 2 /* Process recipient and send via Cit net */
203 /****************************************************************************/
206 * Floor record. The floor number is implicit in its location in the file.
209 unsigned short f_flags; /* flags */
210 char f_name[256]; /* name of floor */
211 int f_ref_count; /* reference count */
212 struct ExpirePolicy f_ep; /* default expiration policy */
215 #define F_INUSE 1 /* floor is in use */
218 /****************************************************************************
219 * Values used internally for function call returns, etc.
222 #define NEWREGISTER 0 /* new user to register */
223 #define REREGISTER 1 /* existing user reregistering */
225 #define READ_HEADER 2
226 #define READ_MSGBODY 3
228 /* commands we can send to the sttybbs() routine */
229 #define SB_NO_INTR 0 /* set to bbs mode, i/q disabled */
230 #define SB_YES_INTR 1 /* set to bbs mode, i/q enabled */
231 #define SB_SAVE 2 /* save settings */
232 #define SB_RESTORE 3 /* restore settings */
233 #define SB_LAST 4 /* redo the last command sent */
238 /* server exit codes */
239 #define EXIT_NORMAL 0 /* server terminated normally */
240 /* 1 through 63 reserved for signals */
241 #define EXIT_NULL 64 /* EOF on server command input */
243 /* citadel.rc stuff */
244 #define RC_NO 0 /* always no */
245 #define RC_YES 1 /* always yes */
246 #define RC_DEFAULT 2 /* setting depends on user config */
249 #define KA_NO 0 /* no keepalives */
250 #define KA_YES 1 /* full keepalives */
252 /* for <;G>oto and <;S>kip commands */
253 #define GF_GOTO 0 /* <;G>oto floor mode */
254 #define GF_SKIP 1 /* <;S>kip floor mode */
255 #define GF_ZAP 2 /* <;Z>ap floor mode */
258 * MIME types used in Citadel for configuration stuff
260 #define SPOOLMIME "application/x-citadel-delivery-list"
261 #define INTERNETCFG "application/x-citadel-internet-config"
262 #define IGNETCFG "application/x-citadel-ignet-config"
264 #define TRACE lprintf(9, "Checkpoint: %s, %d\n", __FILE__, __LINE__)
267 #define LONG_MAX 2147483647L