Back to index

citadel  8.12
citadel.h
Go to the documentation of this file.
00001 /*
00002  * Main Citadel header file
00003  *
00004  * Copyright (c) 1987-2012 by the citadel.org team
00005  *
00006  * This program is open source software; you can redistribute it and/or modify
00007  * it under the terms of the GNU General Public License version 3.
00008  *
00009  * This program is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  * GNU General Public License for more details.
00013  */
00014 
00015 /* system customizations are in sysconfig.h */
00016 
00017 #ifndef CITADEL_H
00018 #define CITADEL_H
00019 /* #include <dmalloc.h> uncomment if using dmalloc */
00020 
00021 #include "sysdep.h"
00022 #include <limits.h>
00023 #include "sysconfig.h"
00024 #include "typesize.h"
00025 #include "ipcdef.h"
00026 
00027 #ifdef __cplusplus
00028 extern "C" {
00029 #endif
00030 
00031 /*
00032  * Text description of this software
00033  * (We used to define this ourselves, but why bother when
00034  * the GNU build tools do it for us?)
00035  */
00036 #define CITADEL      PACKAGE_STRING
00037 
00038 /*
00039  * REV_LEVEL is the current version number (multiplied by 100 to avoid having
00040  * to fiddle with the decimal).  REV_MIN is the oldest version of Citadel
00041  * whose data files are compatible with the current version.  If the data files
00042  * are older than REV_MIN, none of the programs will work until the setup
00043  * program is run again to bring things up to date.  EXPORT_REV_MIN is the
00044  * oldest version of Citadel whose export files we can read.  The latter is
00045  * usually more strict because you're not really supposed to dump/load and
00046  * upgrade at the same time.
00047  */
00048 #define REV_LEVEL    812           /* This version */
00049 #define REV_MIN             591           /* Oldest compatible database */
00050 #define EXPORT_REV_MIN      760           /* Oldest compatible export files */
00051 #define LIBCITADEL_MIN      812           /* Minimum required version of libcitadel */
00052 
00053 #define SERVER_TYPE 0                     /* zero for stock Citadel; other developers please
00054                                       obtain SERVER_TYPE codes for your implementations */
00055 
00056 #ifdef LIBCITADEL_VERSION_NUMBER
00057 #if LIBCITADEL_VERSION_NUMBER < LIBCITADEL_MIN
00058 #error libcitadel is too old.  Please upgrade it before continuing.
00059 #endif
00060 #endif
00061 
00062 /* Various length constants */
00063 
00064 #define UGLISTLEN    100    /* you get a ungoto list of this size */
00065 #define ROOMNAMELEN  128    /* The size of a roomname string */
00066 #define NONCE_SIZE   128    /* Added by <bc> to allow for APOP auth 
00067                              * it is BIG becuase there is a hostname
00068                              * in the nonce, as per the APOP RFC.
00069                              */
00070                                     
00071 #define USERNAME_SIZE       64     /* The size of a username string */
00072 #define MAX_EDITORS  5      /* # of external editors supported */
00073                             /* MUST be at least 1 */
00074 
00075 /*
00076  * Message expiration policy stuff
00077  */
00078 typedef struct ExpirePolicy ExpirePolicy;
00079 struct ExpirePolicy {
00080        int expire_mode;
00081        int expire_value;
00082 };
00083 
00084 #define EXPIRE_NEXTLEVEL    0      /* Inherit expiration policy    */
00085 #define EXPIRE_MANUAL              1      /* Don't expire messages at all */
00086 #define EXPIRE_NUMMSGS             2      /* Keep only latest n messages  */
00087 #define EXPIRE_AGE          3      /* Expire messages after n days */
00088 
00089 
00090 /*
00091  * This struct stores a list of rooms with new messages which the client
00092  * fetches from the server.  This allows the client to "march" through
00093  * relevant rooms without having to ask the server each time where to go next.
00094  */
00095 typedef struct march march;
00096 struct march {
00097        struct march *next;
00098        char march_name[ROOMNAMELEN];
00099        unsigned int march_flags;
00100        char march_floor;
00101        char march_order;
00102        unsigned int march_flags2;
00103        int march_access;
00104 };
00105 
00106 #define NODENAME            config.c_nodename
00107 #define FQDN                config.c_fqdn
00108 #define HUMANNODE           config.c_humannode
00109 #define PHONENUM            config.c_phonenum
00110 #define CTDLUID                    config.c_ctdluid
00111 #define CREATAIDE           config.c_creataide
00112 #define REGISCALL           config.c_regiscall
00113 #define TWITDETECT          config.c_twitdetect
00114 #define TWITROOM            config.c_twitroom
00115 #define RESTRICT_INTERNET   config.c_restrict
00116 
00117 /*
00118  * User records.
00119  */
00120 typedef struct ctdluser ctdluser;
00121 struct ctdluser {                  /* User record                      */
00122        int version;                /* Cit vers. which created this rec  */
00123        uid_t uid;                  /* Associate with a unix account?    */
00124        char password[32];          /* password                          */
00125        unsigned flags;                    /* See US_ flags below               */
00126        long timescalled;           /* Total number of logins            */
00127        long posted;                /* Number of messages ever submitted */
00128        cit_uint8_t axlevel;        /* Access level                      */
00129        long usernum;               /* User number (never recycled)      */
00130        time_t lastcall;            /* Date/time of most recent login    */
00131        int USuserpurge;            /* Purge time (in days) for user     */
00132        char fullname[64];          /* Display name (primary identifier) */
00133 };
00134 
00135 
00136 /* Bits which may appear in CitControl.MMflags.  Note that these don't
00137  * necessarily pertain to the message base -- it's just a good place to
00138  * store any global flags.
00139  */
00140 #define MM_VALID     4             /* New users need validating        */
00141 
00142 /*
00143  * Room records.
00144  */
00145 typedef struct ctdlroom ctdlroom;
00146 struct ctdlroom {
00147        char QRname[ROOMNAMELEN];   /* Name of room                     */
00148        char QRpasswd[10];          /* Only valid if it's a private rm  */
00149        long QRroomaide;            /* User number of room aide         */
00150        long QRhighest;                    /* Highest message NUMBER in room   */
00151        time_t QRgen;               /* Generation number of room        */
00152        unsigned QRflags;           /* See flag values below            */
00153        char QRdirname[15];         /* Directory name, if applicable    */
00154        long QRinfo;                /* Info file update relative to msgs*/
00155        char QRfloor;               /* Which floor this room is on      */
00156        time_t QRmtime;                    /* Date/time of last post           */
00157        struct ExpirePolicy QRep;   /* Message expiration policy        */
00158        long QRnumber;                     /* Globally unique room number      */
00159        char QRorder;               /* Sort key for room listing order  */
00160        unsigned QRflags2;          /* Additional flags                 */
00161        int QRdefaultview;          /* How to display the contents      */
00162 };
00163 
00164 /* Private rooms are always flagged with QR_PRIVATE.  If neither QR_PASSWORDED
00165  * or QR_GUESSNAME is set, then it is invitation-only.  Passworded rooms are
00166  * flagged with both QR_PRIVATE and QR_PASSWORDED while guess-name rooms are
00167  * flagged with both QR_PRIVATE and QR_GUESSNAME.  NEVER set all three flags.
00168  */
00169 
00170 /*
00171  * Miscellaneous
00172  */
00173 #define MES_NORMAL   65            /* Normal message                   */
00174 #define MES_ANONONLY 66            /* "****" header                    */
00175 #define MES_ANONOPT  67            /* "Anonymous" header               */
00176 
00177 #define MES_ERROR    (-1)   /* Can't send message due to bad address   */
00178 #define MES_LOCAL    0      /* Local message, do no network processing */
00179 #define MES_INTERNET 1      /* Convert msg and send as Internet mail   */
00180 #define MES_IGNET    2      /* Process recipient and send via Cit net  */
00181 
00182 /****************************************************************************/
00183 
00184 /*
00185  * Floor record.  The floor number is implicit in its location in the file.
00186  */
00187 typedef struct floor floor;
00188 struct floor {
00189        unsigned short f_flags;            /* flags */
00190        char f_name[256];           /* name of floor */
00191        int f_ref_count;            /* reference count */
00192        struct ExpirePolicy f_ep;   /* default expiration policy */
00193 };
00194 
00195 #define F_INUSE             1             /* floor is in use */
00196 
00197 
00198 /*
00199  * Values used internally for function call returns, etc.
00200  */
00201 
00202 #define NEWREGISTER  0             /* new user to register */
00203 #define REREGISTER   1             /* existing user reregistering */
00204 
00205 #define READ_HEADER  2
00206 #define READ_MSGBODY 3
00207 
00208 /* commands we can send to the stty_ctdl() routine */
00209 #define SB_NO_INTR   0             /* set to Citadel client mode, i/q disabled */
00210 #define SB_YES_INTR  1             /* set to Citadel client mode, i/q enabled */
00211 #define SB_SAVE             2             /* save settings */
00212 #define SB_RESTORE   3             /* restore settings */
00213 #define SB_LAST             4             /* redo the last command sent */
00214 
00215 #define       NEXT_KEY      15
00216 #define STOP_KEY     3
00217 
00218 /* citadel.rc stuff */
00219 #define RC_NO        0             /* always no */
00220 #define RC_YES              1             /* always yes */
00221 #define RC_DEFAULT   2             /* setting depends on user config */
00222 
00223 /* keepalives */
00224 enum {
00225        KA_NO,                      /* no keepalives */
00226        KA_YES,                            /* full keepalives */
00227        KA_HALF                            /* half keepalives */
00228 };
00229 
00230 /* for <;G>oto and <;S>kip commands */
00231 #define GF_GOTO             0             /* <;G>oto floor mode */
00232 #define GF_SKIP             1             /* <;S>kip floor mode */
00233 #define GF_ZAP              2             /* <;Z>ap floor mode */
00234 
00235 /* number of items which may be handled by the CONF command */
00236 #define NUM_CONFIGS 70
00237 
00238 /*
00239  * MIME types used in Citadel for configuration stuff
00240  */
00241 #define SPOOLMIME    "application/x-citadel-delivery-list"
00242 #define       INTERNETCFG   "application/x-citadel-internet-config"
00243 #define IGNETCFG     "application/x-citadel-ignet-config"
00244 #define IGNETMAP     "application/x-citadel-ignet-map"
00245 #define FILTERLIST   "application/x-citadel-filter-list"
00246 #define SIEVECONFIG  "application/x-citadel-sieve-config"
00247 #define XMPPMORTUARY "application/x-citadel-xmpp-mortuary"
00248 
00249 #define TRACE syslog(LOG_DEBUG, "Checkpoint: %s, %d\n", __FILE__, __LINE__)
00250 
00251 #ifndef LONG_MAX
00252 #define LONG_MAX 2147483647L
00253 #endif
00254 
00255 /*
00256  * Authentication modes
00257  */
00258 #define AUTHMODE_NATIVE            0      /* Native (self-contained or "black box") */
00259 #define AUTHMODE_HOST              1      /* Authenticate against the host OS user database */
00260 #define AUTHMODE_LDAP              2      /* Authenticate against an LDAP server with RFC 2307 schema */
00261 #define AUTHMODE_LDAP_AD    3      /* Authenticate against non-standard MS Active Directory LDAP */
00262 
00263 #ifdef __cplusplus
00264 }
00265 #endif
00266 
00267 #endif /* CITADEL_H */