Moved from citadel.h to server.h
[citadel.git] / citadel / server / citadel.h
1 // Main Citadel header file
2 //
3 // Copyright (c) 1987-2022 by the citadel.org team
4 //
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.
8
9 #ifndef CITADEL_H
10 #define CITADEL_H
11
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"
16
17 #include "sysdep.h"
18 #include <limits.h>
19 #include "sysconfig.h"
20 #include "typesize.h"
21 #include "ipcdef.h"
22
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26
27
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
33
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)
38
39 #ifdef LIBCITADEL_VERSION_NUMBER
40 #if LIBCITADEL_VERSION_NUMBER < LIBCITADEL_MIN
41 #error libcitadel is too old.  Please upgrade it before continuing.
42 #endif
43 #endif
44
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"
49
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
54
55 // Message expiration policy stuff
56 typedef struct ExpirePolicy ExpirePolicy;
57 struct ExpirePolicy {
58         int expire_mode;
59         int expire_value;
60 };
61
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
66
67 // Bits which may appear in MMflags.
68 #define MM_VALID        4               // New users need validating
69
70 // Miscellaneous
71 #define MES_NORMAL      65              // Normal message
72 #define MES_ANONONLY    66              // "****" header
73 #define MES_ANONOPT     67              // "Anonymous" header
74
75 // Floor record.  The floor number is implicit in its location in the file.
76 struct floor {
77         unsigned short f_flags;         // flags
78         char f_name[256];               // name of floor
79         int f_ref_count;                // reference count
80         struct ExpirePolicy f_ep;       // default expiration policy
81 };
82
83 #define F_INUSE         1               // floor is in use
84
85 // Values used internally for function call returns, etc.
86 #define NEWREGISTER     0               // new user to register
87 #define REREGISTER      1               // existing user reregistering
88
89 // number of items which may be handled by the CONF command
90 #define NUM_CONFIGS 71
91
92 #define TRACE   syslog(LOG_DEBUG, "\033[7m  Checkpoint: %s : %d  \033[0m", __FILE__, __LINE__)
93
94 #ifndef LONG_MAX
95 #define LONG_MAX 2147483647L
96 #endif
97
98 // Authentication modes
99 #define AUTHMODE_NATIVE         0       // Native (self-contained or "black box")
100 #define AUTHMODE_HOST           1       // Authenticate against the host OS user database
101 #define AUTHMODE_LDAP           2       // Authenticate using LDAP server with POSIX schema
102 #define AUTHMODE_LDAP_AD        3       // Authenticate using LDAP server with Active Directory schema
103
104 #ifdef __cplusplus
105 }
106 #endif
107
108 #endif // CITADEL_H