7 #define INLINE __inline__
14 #define OPENSSL_NO_KRB5 /* work around redhat b0rken ssl headers */
15 #include <openssl/ssl.h>
19 * New format for a message in memory
22 int cm_magic; /* Self-check (NOT SAVED TO DISK) */
23 char cm_anon_type; /* Anonymous or author-visible */
24 char cm_format_type; /* Format type */
25 char *cm_fields[256]; /* Data fields */
26 unsigned int cm_flags; /* How to handle (NOT SAVED TO DISK) */
29 #define CTDLMESSAGE_MAGIC 0x159d
30 #define CM_SKIP_HOOKS 0x01 /* Don't run server-side handlers */
34 #define CTDLEXIT_SHUTDOWN 0 /* Normal shutdown; do NOT auto-restart */
37 * Exit codes 101 through 109 are used for conditions in which
38 * we deliberately do NOT want the service to automatically
41 #define CTDLEXIT_CONFIG 101 /* Could not read citadel.config */
42 #define CTDLEXIT_CONTROL 102 /* Could not acquire lock */
43 #define CTDLEXIT_HOME 103 /* Citadel home directory not found */
44 #define CTDLEXIT_OOD 104 /* Out Of Date config - rerun setup */
45 #define CTDLEXIT_DB 105 /* Unable to initialize database */
46 #define CTDLEXIT_LIBCITADEL 106 /* Incorrect version of libcitadel */
47 #define CTDL_EXIT_UNSUP_AUTH 107 /* Unsupported auth mode configured */
51 #define CS_STEALTH 1 /* stealth mode */
52 #define CS_CHAT 2 /* chat mode */
53 #define CS_POSTING 4 /* Posting */
57 * This is the control record for the message base...
60 long MMhighest; /* highest message number in file */
61 unsigned MMflags; /* Global system flags */
62 long MMnextuser; /* highest user number on system */
63 long MMnextroom; /* highest room number on system */
64 int version; /* Server-hosted upgrade level */
65 int fulltext_wordbreaker; /* ID of wordbreaker in use */
66 long MMfulltext; /* highest message number indexed */
67 int MMdbversion; /* Version of Berkeley DB used on previous server run */
70 extern int ScheduledShutdown;
71 extern struct CitControl CitControl;
73 struct ExpressMessage {
74 struct ExpressMessage *next;
75 time_t timestamp; /* When this message was sent */
76 unsigned flags; /* Special instructions */
77 char sender[256]; /* Name of sending user */
78 char sender_email[256]; /* Email or JID of sending user */
79 char *text; /* Message text (if applicable) */
82 #define EM_BROADCAST 1 /* Broadcast message */
83 #define EM_GO_AWAY 2 /* Server requests client log off */
84 #define EM_CHAT 4 /* Server requests client enter chat */
87 * Various things we need to lock and unlock
132 * message transfer formats
135 MT_CITADEL, /* Citadel proprietary */
136 MT_RFC822, /* RFC822 */
137 MT_MIME, /* MIME-formatted message */
138 MT_DOWNLOAD, /* Download a component */
139 MT_SPEW_SECTION /* Download a component in a single operation */
143 * Message format types in the database
145 #define FMT_CITADEL 0 /* Citadel vari-format (proprietary) */
146 #define FMT_FIXED 1 /* Fixed format (proprietary) */
147 #define FMT_RFC822 4 /* Standard (headers are in M field) */
151 * Citadel DataBases (define one for each cdb we need to open)
154 CDB_MSGMAIN, /* message base */
155 CDB_USERS, /* user file */
156 CDB_ROOMS, /* room index */
157 CDB_FLOORTAB, /* floor index */
158 CDB_MSGLISTS, /* room message lists */
159 CDB_VISIT, /* user/room relationships */
160 CDB_DIRECTORY, /* address book directory */
161 CDB_USETABLE, /* network use table */
162 CDB_BIGMSGS, /* larger message bodies */
163 CDB_FULLTEXT, /* full text search index */
164 CDB_EUIDINDEX, /* locate msgs by EUID */
165 CDB_USERSBYNUMBER, /* index of users by number */
166 CDB_OPENID, /* associates OpenIDs with users */
167 MAXCDB /* total number of CDB's defined */
177 * Event types can't be enum'ed, because they must remain consistent between
178 * builds (to allow for binary modules built somewhere else)
180 #define EVT_STOP 0 /* Session is terminating */
181 #define EVT_START 1 /* Session is starting */
182 #define EVT_LOGIN 2 /* A user is logging in */
183 #define EVT_NEWROOM 3 /* Changing rooms */
184 #define EVT_LOGOUT 4 /* A user is logging out */
185 #define EVT_SETPASS 5 /* Setting or changing password */
186 #define EVT_CMD 6 /* Called after each server command */
187 #define EVT_RWHO 7 /* An RWHO command is being executed */
188 #define EVT_ASYNC 8 /* Doing asynchronous messages */
189 #define EVT_STEALTH 9 /* Entering stealth mode */
190 #define EVT_UNSTEALTH 10 /* Exiting stealth mode */
192 #define EVT_TIMER 50 /* Timer events are called once per minute
193 and are not tied to any session */
194 #define EVT_HOUSE 51 /* as needed houskeeping stuff */
195 #define EVT_SHUTDOWN 52 /* Server is shutting down */
197 #define EVT_PURGEUSER 100 /* Deleting a user */
198 #define EVT_NEWUSER 102 /* Creating a user */
200 #define EVT_BEFOREREAD 200
201 #define EVT_BEFORESAVE 201
202 #define EVT_AFTERSAVE 202
203 #define EVT_SMTPSCAN 203 /* called before submitting a msg from SMTP */
204 /* Priority levels for paging functions (lower is better) */
206 XMSG_PRI_LOCAL, /* Other users on -this- server */
207 XMSG_PRI_REMOTE, /* Other users on a Citadel network (future) */
208 XMSG_PRI_FOREIGN, /* Contacts on foreign instant message hosts */
213 /* Defines the relationship of a user to a particular room */
214 typedef struct __visit {
219 unsigned int v_flags;
221 char v_answered[SIZ];
225 #define V_FORGET 1 /* User has zapped this room */
226 #define V_LOCKOUT 2 /* User is locked out of this room */
227 #define V_ACCESS 4 /* Access is granted to this room */
230 /* Supplementary data for a message on disk
231 * These are kept separate from the message itself for one of two reasons:
232 * 1. Either their values may change at some point after initial save, or
233 * 2. They are merely caches of data which exist somewhere else, for speed.
236 long meta_msgnum; /* Message number in *local* message base */
237 int meta_refcount; /* Number of rooms pointing to this msg */
238 char meta_content_type[64]; /* Cached MIME content-type */
239 long meta_rfc822_length; /* Cache of RFC822-translated msg length */
240 char mimetype[64]; /* if we were able to guess the mimetype for the data */
243 /* Calls to AdjRefCount() are queued and deferred, so the user doesn't
244 * have to wait for various disk-intensive operations to complete synchronously.
245 * This is the record format.
248 long arcq_msgnum; /* Message number being adjusted */
249 int arcq_delta; /* Adjustment ( usually 1 or -1 ) */
254 * Serialization routines use this struct to return a pointer and a length
263 * The S_USETABLE database is used in several modules now, so we define its format here.
272 /* Preferred field order */
273 /* ********** Important fields */
274 /* *************** Semi-important fields */
275 /* * Message text (MUST be last) */
276 #define FORDER "IPTAFONHRDBCEWJGKLQSVXZYUM"
278 #endif /* SERVER_H */