citadel
About: Citadel is an advanced messaging and collaboration system for groupware and BBS applications (preferred OS: Linux).
  Fossies Dox: citadel.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

citadel.h
Go to the documentation of this file.
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
24extern "C" {
25#endif
26
27
28#define REV_LEVEL 957 // 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
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// User records.
68typedef struct ctdluser ctdluser;
69struct 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
86};
87
88// Bits which may appear in MMflags.
89#define MM_VALID 4 // New users need validating
90
91// Room records.
92typedef struct ctdlroom ctdlroom;
93struct 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
110};
111
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.
116
117// Miscellaneous
118#define MES_NORMAL 65 // Normal message
119#define MES_ANONONLY 66 // "****" header
120#define MES_ANONOPT 67 // "Anonymous" header
121
122// Floor record. The floor number is implicit in its location in the file.
123typedef struct floor floor;
124struct 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
129};
130
131#define F_INUSE 1 // floor is in use
132
133// Values used internally for function call returns, etc.
134#define NEWREGISTER 0 // new user to register
135#define REREGISTER 1 // existing user reregistering
136
137// number of items which may be handled by the CONF command
138#define NUM_CONFIGS 71
139
140#define TRACE syslog(LOG_DEBUG, "\033[7m Checkpoint: %s : %d \033[0m", __FILE__, __LINE__)
141
142#ifndef LONG_MAX
143#define LONG_MAX 2147483647L
144#endif
145
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
151
152#ifdef __cplusplus
153}
154#endif
155
156#endif // CITADEL_H
#define ROOMNAMELEN
Definition: citadel.h:51
int expire_mode
Definition: citadel.h:58
int expire_value
Definition: citadel.h:59
char QRfloor
Definition: citadel.h:102
unsigned QRflags2
Definition: citadel.h:107
time_t QRmtime
Definition: citadel.h:103
long QRroomaide
Definition: citadel.h:96
long msgnum_info
Definition: citadel.h:101
char QRname[128]
Definition: citadel.h:94
char QRpasswd[10]
Definition: citadel.h:95
long QRnumber
Definition: citadel.h:105
struct ExpirePolicy QRep
Definition: citadel.h:104
unsigned QRflags
Definition: citadel.h:99
long QRhighest
Definition: citadel.h:97
time_t QRgen
Definition: citadel.h:98
long msgnum_pic
Definition: citadel.h:109
char QRdirname[15]
Definition: citadel.h:100
int QRdefaultview
Definition: citadel.h:108
char QRorder
Definition: citadel.h:106
long posted
Definition: citadel.h:75
long msgnum_bio
Definition: citadel.h:81
unsigned flags
Definition: citadel.h:73
cit_uint8_t axlevel
Definition: citadel.h:76
char fullname[64]
Definition: citadel.h:80
time_t lastcall
Definition: citadel.h:78
long msgnum_inboxrules
Definition: citadel.h:84
long timescalled
Definition: citadel.h:74
uid_t uid
Definition: citadel.h:71
long usernum
Definition: citadel.h:77
int version
Definition: citadel.h:70
char password[32]
Definition: citadel.h:72
int USuserpurge
Definition: citadel.h:79
long msgnum_pic
Definition: citadel.h:82
long lastproc_inboxrules
Definition: citadel.h:85
char emailaddrs[512]
Definition: citadel.h:83
Definition: citadel.h:124
struct ExpirePolicy f_ep
Definition: citadel.h:128
int f_ref_count
Definition: citadel.h:127
char f_name[256]
Definition: citadel.h:126
unsigned short f_flags
Definition: citadel.h:125
unsigned char cit_uint8_t
Definition: typesize.h:38