1 // Main Citadel header file
3 // Copyright (c) 1987-2022 by the citadel.org team
5 // This program is open source software. Use, duplication, or disclosure
6 // is subject to the terms of the GNU General Public License, version 3.
7 // The program is distributed without any warranty, expressed or implied.
12 // Suppress these compiler warnings
13 #pragma GCC diagnostic ignored "-Wcast-qual"
14 #pragma GCC diagnostic ignored "-Wdiscarded-qualifiers"
15 #pragma GCC diagnostic ignored "-Wformat-truncation"
19 #include "sysconfig.h"
28 #define REV_LEVEL 963 // This version
29 #define REV_MIN 591 // Oldest compatible database
30 #define EXPORT_REV_MIN 931 // Oldest compatible export files
31 #define LIBCITADEL_MIN 951 // Minimum required version of libcitadel
32 #define SERVER_TYPE 0 // zero for stock Citadel; other developers please obtain SERVER_TYPE codes for your implementations
34 // hats off to https://stackoverflow.com/questions/5459868/concatenate-int-to-string-using-c-preprocessor
35 #define STR_HELPER(x) #x
36 #define STR(x) STR_HELPER(x)
37 #define CITADEL "Citadel Server " STR(REV_LEVEL)
39 #ifdef LIBCITADEL_VERSION_NUMBER
40 #if LIBCITADEL_VERSION_NUMBER < LIBCITADEL_MIN
41 #error libcitadel is too old. Please upgrade it before continuing.
45 // This is the user name and password for the default administrator account
46 // that is created when Citadel Server is started with an empty database.
47 #define DEFAULT_ADMIN_USERNAME "admin"
48 #define DEFAULT_ADMIN_PASSWORD "citadel"
50 // Various length constants
51 #define ROOMNAMELEN 128 // The size of a roomname string
52 #define USERNAME_SIZE 64 // The size of a username string
53 #define MAX_EDITORS 5 // number of external editors supported ; must be at least 1
55 // Message expiration policy stuff
56 typedef struct ExpirePolicy ExpirePolicy;
62 #define EXPIRE_NEXTLEVEL 0 // Inherit expiration policy
63 #define EXPIRE_MANUAL 1 // Don't expire messages at all
64 #define EXPIRE_NUMMSGS 2 // Keep only latest n messages
65 #define EXPIRE_AGE 3 // Expire messages after n days
68 typedef struct ctdluser ctdluser;
69 struct ctdluser { // User record
70 int version; // Citadel version which created this record
71 uid_t uid; // Associate with a unix account?
72 char password[32]; // password
73 unsigned flags; // See US_ flags below
74 long timescalled; // Total number of logins
75 long posted; // Number of messages ever submitted
76 cit_uint8_t axlevel; // Access level
77 long usernum; // User number (never recycled)
78 time_t lastcall; // Date/time of most recent login
79 int USuserpurge; // Purge time (in days) for user
80 char fullname[64]; // Display name (primary identifier)
81 long msgnum_bio; // msgnum of user's profile (bio)
82 long msgnum_pic; // msgnum of user's avatar (photo)
83 char emailaddrs[512]; // Internet email addresses
84 long msgnum_inboxrules; // msgnum of user's inbox filtering rules
85 long lastproc_inboxrules; // msgnum of last message filtered
88 // Bits which may appear in MMflags.
89 #define MM_VALID 4 // New users need validating
92 typedef struct ctdlroom ctdlroom;
94 char QRname[ROOMNAMELEN]; // Name of room
95 char QRpasswd[10]; // Only valid if it's a private rm
96 long QRroomaide; // User number of room aide
97 long QRhighest; // Highest message NUMBER in room
98 time_t QRgen; // Generation number of room
99 unsigned QRflags; // See flag values below
100 char QRdirname[15]; // Directory name, if applicable
101 long msgnum_info; // msgnum of room banner (info file)
102 char QRfloor; // Which floor this room is on
103 time_t QRmtime; // Date/time of last post
104 struct ExpirePolicy QRep; // Message expiration policy
105 long QRnumber; // Globally unique room number
106 char QRorder; // Sort key for room listing order
107 unsigned QRflags2; // Additional flags
108 int QRdefaultview; // How to display the contents
109 long msgnum_pic; // msgnum of room picture or icon
112 // Private rooms are always flagged with QR_PRIVATE. If neither QR_PASSWORDED
113 // or QR_GUESSNAME is set, then it is invitation-only. Passworded rooms are
114 // flagged with both QR_PRIVATE and QR_PASSWORDED while guess-name rooms are
115 // flagged with both QR_PRIVATE and QR_GUESSNAME. NEVER set all three flags.
118 #define MES_NORMAL 65 // Normal message
119 #define MES_ANONONLY 66 // "****" header
120 #define MES_ANONOPT 67 // "Anonymous" header
122 // Floor record. The floor number is implicit in its location in the file.
123 typedef struct floor floor;
125 unsigned short f_flags; // flags
126 char f_name[256]; // name of floor
127 int f_ref_count; // reference count
128 struct ExpirePolicy f_ep; // default expiration policy
131 #define F_INUSE 1 // floor is in use
133 // Values used internally for function call returns, etc.
134 #define NEWREGISTER 0 // new user to register
135 #define REREGISTER 1 // existing user reregistering
137 // number of items which may be handled by the CONF command
138 #define NUM_CONFIGS 71
140 #define TRACE syslog(LOG_DEBUG, "\033[7m Checkpoint: %s : %d \033[0m", __FILE__, __LINE__)
143 #define LONG_MAX 2147483647L
146 // Authentication modes
147 #define AUTHMODE_NATIVE 0 // Native (self-contained or "black box")
148 #define AUTHMODE_HOST 1 // Authenticate against the host OS user database
149 #define AUTHMODE_LDAP 2 // Authenticate using LDAP server with POSIX schema
150 #define AUTHMODE_LDAP_AD 3 // Authenticate using LDAP server with Active Directory schema