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 972 // 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
67 // Bits which may appear in MMflags.
68 #define MM_VALID 4 // New users need validating
72 char QRname[ROOMNAMELEN]; // Name of room
73 char QRpasswd[10]; // Only valid if it's a private rm
74 long QRroomaide; // User number of room aide
75 long QRhighest; // Highest message NUMBER in room
76 time_t QRgen; // Generation number of room
77 unsigned QRflags; // See flag values below
78 char QRdirname[15]; // Directory name, if applicable
79 long msgnum_info; // msgnum of room banner (info file)
80 char QRfloor; // Which floor this room is on
81 time_t QRmtime; // Date/time of last post
82 struct ExpirePolicy QRep; // Message expiration policy
83 long QRnumber; // Globally unique room number
84 char QRorder; // Sort key for room listing order
85 unsigned QRflags2; // Additional flags
86 int QRdefaultview; // How to display the contents
87 long msgnum_pic; // msgnum of room picture or icon
90 // Private rooms are always flagged with QR_PRIVATE. If neither QR_PASSWORDED
91 // or QR_GUESSNAME is set, then it is invitation-only. Passworded rooms are
92 // flagged with both QR_PRIVATE and QR_PASSWORDED while guess-name rooms are
93 // flagged with both QR_PRIVATE and QR_GUESSNAME. NEVER set all three flags.
96 #define MES_NORMAL 65 // Normal message
97 #define MES_ANONONLY 66 // "****" header
98 #define MES_ANONOPT 67 // "Anonymous" header
100 // Floor record. The floor number is implicit in its location in the file.
102 unsigned short f_flags; // flags
103 char f_name[256]; // name of floor
104 int f_ref_count; // reference count
105 struct ExpirePolicy f_ep; // default expiration policy
108 #define F_INUSE 1 // floor is in use
110 // Values used internally for function call returns, etc.
111 #define NEWREGISTER 0 // new user to register
112 #define REREGISTER 1 // existing user reregistering
114 // number of items which may be handled by the CONF command
115 #define NUM_CONFIGS 71
117 #define TRACE syslog(LOG_DEBUG, "\033[7m Checkpoint: %s : %d \033[0m", __FILE__, __LINE__)
120 #define LONG_MAX 2147483647L
123 // Authentication modes
124 #define AUTHMODE_NATIVE 0 // Native (self-contained or "black box")
125 #define AUTHMODE_HOST 1 // Authenticate against the host OS user database
126 #define AUTHMODE_LDAP 2 // Authenticate using LDAP server with POSIX schema
127 #define AUTHMODE_LDAP_AD 3 // Authenticate using LDAP server with Active Directory schema