This is an omnibus commit which moves the Citadel Server from crusty old GNU Autotool...
[citadel.git] / citadel / server / citadel.h
1 // Main Citadel header file
2 //
3 // Copyright (c) 1987-2021 by the citadel.org team
4 //
5 // This program is open source software; you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License version 3.
7 //
8 // This program is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11 // GNU General Public License for more details.
12
13 /* system customizations are in sysconfig.h */
14
15 #ifndef CITADEL_H
16 #define CITADEL_H
17 /* #include <dmalloc.h> uncomment if using dmalloc */
18
19 #include "sysdep.h"
20 #include <limits.h>
21 #include "sysconfig.h"
22 #include "typesize.h"
23 #include "ipcdef.h"
24
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
28
29 /*
30  * Text description of this software
31  * (We used to define this ourselves, but why bother when the build tools do it for us?)
32  */
33 #define CITADEL PACKAGE_STRING
34
35 #define REV_LEVEL 951           // This version
36 #define REV_MIN         591             // Oldest compatible database
37 #define EXPORT_REV_MIN  931             // Oldest compatible export files
38 #define LIBCITADEL_MIN  931             // Minimum required version of libcitadel
39 #define SERVER_TYPE     0               // zero for stock Citadel; other developers please obtain SERVER_TYPE codes for your implementations
40
41 #ifdef LIBCITADEL_VERSION_NUMBER
42 #if LIBCITADEL_VERSION_NUMBER < LIBCITADEL_MIN
43 #error libcitadel is too old.  Please upgrade it before continuing.
44 #endif
45 #endif
46
47 /*
48  * This is the user name and password for the default administrator account
49  * that is created when Citadel Server is started with an empty database.
50  */
51 #define DEFAULT_ADMIN_USERNAME  "admin"
52 #define DEFAULT_ADMIN_PASSWORD  "citadel"
53
54 /* Various length constants */
55
56 #define ROOMNAMELEN     128             /* The size of a roomname string */
57 #define USERNAME_SIZE   64              /* The size of a username string */
58 #define MAX_EDITORS     5               /* number of external editors supported ; must be at least 1 */
59
60 /*
61  * Message expiration policy stuff
62  */
63 typedef struct ExpirePolicy ExpirePolicy;
64 struct ExpirePolicy {
65         int expire_mode;
66         int expire_value;
67 };
68
69 #define EXPIRE_NEXTLEVEL        0       // Inherit expiration policy
70 #define EXPIRE_MANUAL           1       // Don't expire messages at all
71 #define EXPIRE_NUMMSGS          2       // Keep only latest n messages
72 #define EXPIRE_AGE              3       // Expire messages after n days
73
74
75 /*
76  * User records.
77  */
78 typedef struct ctdluser ctdluser;
79 struct ctdluser {                       // User record
80         int version;                    // Citadel version which created this record
81         uid_t uid;                      // Associate with a unix account?
82         char password[32];              // password
83         unsigned flags;                 // See US_ flags below
84         long timescalled;               // Total number of logins
85         long posted;                    // Number of messages ever submitted
86         cit_uint8_t axlevel;            // Access level
87         long usernum;                   // User number (never recycled)
88         time_t lastcall;                // Date/time of most recent login
89         int USuserpurge;                // Purge time (in days) for user
90         char fullname[64];              // Display name (primary identifier)
91         long msgnum_bio;                // msgnum of user's profile (bio)
92         long msgnum_pic;                // msgnum of user's avatar (photo)
93         char emailaddrs[512];           // Internet email addresses
94         long msgnum_inboxrules;         // msgnum of user's inbox filtering rules
95         long lastproc_inboxrules;       // msgnum of last message filtered
96 };
97
98
99 /* Bits which may appear in MMflags.
100  */
101 #define MM_VALID        4               // New users need validating
102
103 /*
104  * Room records.
105  */
106 typedef struct ctdlroom ctdlroom;
107 struct ctdlroom {
108         char QRname[ROOMNAMELEN];       // Name of room
109         char QRpasswd[10];              // Only valid if it's a private rm
110         long QRroomaide;                // User number of room aide
111         long QRhighest;                 // Highest message NUMBER in room
112         time_t QRgen;                   // Generation number of room
113         unsigned QRflags;               // See flag values below
114         char QRdirname[15];             // Directory name, if applicable
115         long msgnum_info;               // msgnum of room banner (info file)
116         char QRfloor;                   // Which floor this room is on
117         time_t QRmtime;                 // Date/time of last post
118         struct ExpirePolicy QRep;       // Message expiration policy
119         long QRnumber;                  // Globally unique room number
120         char QRorder;                   // Sort key for room listing order
121         unsigned QRflags2;              // Additional flags
122         int QRdefaultview;              // How to display the contents
123         long msgnum_pic;                // msgnum of room picture or icon
124 };
125
126 /* Private rooms are always flagged with QR_PRIVATE.  If neither QR_PASSWORDED
127  * or QR_GUESSNAME is set, then it is invitation-only.  Passworded rooms are
128  * flagged with both QR_PRIVATE and QR_PASSWORDED while guess-name rooms are
129  * flagged with both QR_PRIVATE and QR_GUESSNAME.  NEVER set all three flags.
130  */
131
132 /*
133  * Miscellaneous
134  */
135 #define MES_NORMAL      65              // Normal message
136 #define MES_ANONONLY    66              // "****" header
137 #define MES_ANONOPT     67              // "Anonymous" header
138
139 /****************************************************************************/
140
141 /*
142  * Floor record.  The floor number is implicit in its location in the file.
143  */
144 typedef struct floor floor;
145 struct floor {
146         unsigned short f_flags;         // flags
147         char f_name[256];               // name of floor
148         int f_ref_count;                // reference count
149         struct ExpirePolicy f_ep;       // default expiration policy
150 };
151
152 #define F_INUSE         1               // floor is in use
153
154
155 /*
156  * Values used internally for function call returns, etc.
157  */
158 #define NEWREGISTER     0               // new user to register
159 #define REREGISTER      1               // existing user reregistering
160
161 /* number of items which may be handled by the CONF command */
162 #define NUM_CONFIGS 71
163
164 #define TRACE   syslog(LOG_DEBUG, "\033[7m  Checkpoint: %s : %d  \033[0m", __FILE__, __LINE__)
165
166 #ifndef LONG_MAX
167 #define LONG_MAX 2147483647L
168 #endif
169
170 /*
171  * Authentication modes
172  */
173 #define AUTHMODE_NATIVE         0       // Native (self-contained or "black box")
174 #define AUTHMODE_HOST           1       // Authenticate against the host OS user database
175 #define AUTHMODE_LDAP           2       // Authenticate using LDAP server with RFC 2307 schema
176 #define AUTHMODE_LDAP_AD        3       // Authenticate using LDAP server with Active Directory schema
177
178 #ifdef __cplusplus
179 }
180 #endif
181
182 #if __GNUC__ >= 8
183 #pragma GCC diagnostic push
184 #pragma GCC diagnostic ignored "-Wformat-truncation"
185 #endif
186
187 #endif /* CITADEL_H */