]> code.citadel.org Git - citadel.git/blob - citadel/citadel.h
Moved "struct visit" from citadel.h to server.h
[citadel.git] / citadel / citadel.h
1 /* citadel.h
2  * main Citadel/UX header file
3  * see copyright.doc for copyright information
4  */
5
6 /* system customizations are in sysconfig.h */
7 #include "sysdep.h"
8 #include "sysconfig.h"
9 #include "ipcdef.h"
10 #define CITADEL "Citadel/UX DR19980818"
11 #define REV_LEVEL 503
12 #define SERVER_TYPE 0   /* zero for stock Citadel/UX; other developers please
13                            obtain SERVER_TYPE codes for your implementations */
14
15 #undef  tolower
16 #define tolower(x)      ( ((x>='A')&&(x<='Z')) ? (x+'a'-'A') : x )
17 #define NEW_CONFIG
18
19 #define strucmp(lstr,rstr) struncmp(lstr,rstr,32767)
20
21 /* 
22  * The only typedef we do is an 8-bit unsigned, for screen dimensions.
23  * All other defs are done using standard C types.  The code assumes that
24  * 'int' 'unsigned' and 'short' are at least 16 bits, and that 'long' is at
25  * least 32 bits.  There are no endian dependencies in any of the Citadel
26  * programs.
27  */
28 typedef unsigned char CIT_UBYTE;
29
30 #define ROOMNAMELEN     128
31
32 struct config {
33         char c_nodename[16];            /* UUCP and Citadel nodename        */
34         char c_fqdn[64];                /* Fully Qualified Domain Name      */
35         char c_humannode[21];           /* Long name of system              */
36         char c_phonenum[16];            /* Dialup number of system          */
37         int c_bbsuid;                   /* UID of the bbs-only user         */
38         char c_creataide;               /* room creator = room aide  flag   */
39         int c_sleeping;                 /* watchdog timer setting           */
40         char c_initax;                  /* initial access level             */
41         char c_regiscall;               /* call number to register on       */
42         char c_twitdetect;              /* twit detect flag                 */
43         char c_twitroom[ROOMNAMELEN];   /* twit detect msg move to room     */
44         int c_defent;                   /* command generated by <E> key     */
45         char c_moreprompt[80];          /* paginator prompt                 */
46         char c_restrict;                /* restrict Internet mail flag      */
47         long c_msgbase;                 /* size of message base             */
48         char c_bbs_city[32];            /* city and state you are located in*/
49         char c_sysadm[26];              /* name of system administrator     */
50         char c_bucket_dir[15];          /* bit bucket for files...          */
51         int c_setup_level;              /* what rev level we've setup to    */
52         int c_maxsessions;              /* maximum concurrent sessions      */
53         char c_net_password[20];        /* system net password              */
54         int c_port_number;              /* TCP port to run the server on    */
55         int c_ipgm_secret;              /* Internal program authentication  */
56         };
57
58 #define NODENAME                config.c_nodename
59 #define FQDN                    config.c_fqdn
60 #define HUMANNODE               config.c_humannode
61 #define PHONENUM                config.c_phonenum
62 #define BBSUID                  config.c_bbsuid
63 #define CREATAIDE               config.c_creataide
64 #define REGISCALL               config.c_regiscall
65 #define TWITDETECT              config.c_twitdetect
66 #define TWITROOM                config.c_twitroom
67 #define RESTRICT_INTERNET       config.c_restrict
68
69 /* Defines the actual user record */
70 struct usersupp {                       /* User record                      */
71         int USuid;                      /* userid (==BBSUID for bbs only)   */
72         char password[20];              /* password (for BBS-only users)    */
73         unsigned flags;                 /* See US_ flags below              */
74         int timescalled;                /* Total number of logins           */
75         int posted;                     /* Number of messages posted (ever) */
76         char fullname[26];              /* Name for Citadel messages & mail */
77         char axlevel;                   /* Access level                     */
78         CIT_UBYTE USscreenwidth;        /* Screen width (for textmode users)*/
79         CIT_UBYTE USscreenheight;       /* Screen height(for textmode users)*/
80         long usernum;                   /* User number (never recycled)     */
81         time_t lastcall;                /* Last time the user called        */
82         char USname[30];                /* Real name (i.e. not a handle)    */
83         char USaddr[25];                /* Street address                   */
84         char UScity[15];                /* Municipality                     */
85         char USstate[3];                /* State or province                */
86         char USzip[10];                 /* ZIP code                         */
87         char USphone[11];               /* Voice telephone number           */
88         char USemail[32];               /* E-mail address (elsewhere)       */
89         };
90
91
92 /* this is a mask for all of the bits the user is allowed to change */
93 #define US_USER_SET     (US_LASTOLD | US_EXPERT | US_UNLISTED | \
94                         US_NOPROMPT | US_DISAPPEAR | US_PAGINATOR | US_FLOORS)
95
96 /****************************************************************************
97  * This is the control record for the message base... 
98  */
99 struct CitControl {
100         long MMhighest;                 /* highest message number in file   */
101         unsigned MMflags;               /* Global system flags              */
102         long MMnextuser;                /* highest user number on system    */
103         };
104
105 /* Bits which may appear in CitControl.MMflags.  Note that these don't
106  * necessarily pertain to the message base -- it's just a good place to
107  * store any global flags.
108  */
109 #define MM_VALID        4               /* New users need validating        */
110
111 /****************************************************************************
112  * Room records
113  */
114 struct quickroom {
115         char QRname[ROOMNAMELEN];       /* Name of room                     */
116         char QRpasswd[10];              /* Only valid if it's a private rm  */
117         long QRroomaide;                /* User number of room aide         */
118         long QRhighest;                 /* Highest message NUMBER in room   */
119         time_t QRgen;                   /* Generation number of room        */
120         unsigned QRflags;               /* See flag values below            */
121         char QRdirname[15];             /* Directory name, if applicable    */
122         long QRinfo;                    /* Info file update relative to msgs*/
123         char QRfloor;                   /* Which floor this room is on      */
124         time_t QRmtime;                 /* Date/time of last post           */
125         };
126
127
128 /* Private rooms are always flagged with QR_PRIVATE. If neither QR_PASSWORDED
129  * or QR_GUESSNAME is set, then it is invitation-only. Passworded rooms are
130  * flagged with both QR_PRIVATE and QR_PASSWORDED while guess-name rooms are
131  * flagged with both QR_PRIVATE and QR_GUESSNAME. DO NOT set all three flags.
132  *
133  ****************************************************************************/
134
135 /*
136  * Events which might show up in the Citadel Log
137  */
138 #define CL_CONNECT      8               /* Connect to server                */
139 #define CL_LOGIN        16              /* CLfullname logged in             */
140 #define CL_NEWUSER      32              /* CLfullname is a new user         */
141 #define CL_BADPW        64              /* Bad attempt at CLfullname's pw   */
142 #define CL_TERMINATE    128             /* Logout - proper termination      */
143 #define CL_DROPCARR     256             /* Logout - dropped carrier         */
144 #define CL_SLEEPING     512             /* Logout - sleeping                */
145 #define CL_PWCHANGE     1024            /* CLfullname changed passwords     */
146
147 /* Miscellaneous                                                            */
148
149 #define MES_NORMAL      65              /* Normal message                   */
150 #define MES_ANON        66              /* "****" header                    */
151 #define MES_AN2         67              /* "Anonymous" header               */
152
153 #define M_ERROR         (-1)    /* Can't send message due to bad address   */
154 #define M_LOCAL         0       /* Local message, do no network processing */
155 #define M_INTERNET      1       /* Convert msg and send as Internet mail   */
156 #define M_BINARY        2       /* Process recipient and send via C/UX net */
157
158 /****************************************************************************/
159
160 struct recentmsg {
161         char RMnodename[10];
162         long RMnum;                     /* Number or time of message        */
163         };
164
165
166 /****************************************************************************
167  *
168  * Floor record.  The floor number is implicit in its location in the file.
169  */
170 struct floor {
171         unsigned short f_flags;         /* flags */
172         char f_name[256];               /* name of floor */
173         int f_ref_count;                /* reference count */
174         };
175
176 #define F_INUSE         1               /* floor is in use */
177
178
179 /****************************************************************************
180  * Values used internally for function call returns, etc.
181  */
182
183 #define NEWREGISTER     0               /* new user to register */
184 #define REREGISTER      1               /* existing user reregistering */
185
186 #define READ_HEADER     2
187 #define READ_MSGBODY    3
188
189 /* commands we can send to the sttybbs() routine */
190 #define SB_NO_INTR      0               /* set to bbs mode, i/q disabled */
191 #define SB_YES_INTR     1               /* set to bbs mode, i/q enabled */
192 #define SB_SAVE         2               /* save settings */
193 #define SB_RESTORE      3               /* restore settings */
194
195 #define NEXT_KEY        15
196 #define STOP_KEY        3
197
198 /* server exit codes */
199 #define EXIT_NORMAL     0               /* server terminated normally */
200                                         /* 1 through 63 reserved for signals */
201 #define EXIT_NULL       64              /* EOF on server command input */
202
203 /* citadel.rc stuff */
204 #define RC_NO           0               /* always no */
205 #define RC_YES          1               /* always yes */
206 #define RC_DEFAULT      2               /* setting depends on user config */
207
208 /* keepalives */
209 #define KA_NO           0               /* no keepalives */
210 #define KA_YES          1               /* full keepalives */
211 #define KA_CHAT         2               /* half keepalives (for chat mode) */
212
213 /* for <;G>oto and <;S>kip commands */
214 #define GF_GOTO         0               /* <;G>oto floor mode */
215 #define GF_SKIP         1               /* <;S>kip floor mode */
216 #define GF_ZAP          2               /* <;Z>ap floor mode */
217
218 /* message transfer formats */
219 #define MT_CITADEL      0               /* Citadel proprietary */
220 #define MT_RFC822       2               /* RFC822 */
221 #define MT_RAW          3               /* IGnet raw format */
222
223
224
225 #define BASEROOM        "Lobby"
226 #define MAILROOM        "Mail"
227 #define AIDEROOM        "Aide"
228