1 #ifndef __NEWAREA_H_DEFINED
2 #define __NEWAREA_H_DEFINED
3 
4 #include <smapi/msgapi.h>
5 #include <option.h>
6 
7 typedef word zstr;      /* Offset of string within area heap */
8 
9 
10 /* General structure of MAREA.DAT and FAREA.DAT:
11 
12    MAREA_ID or FAREA_ID
13    _msgarea
14        _ovride ...
15        zstr heap
16    _msgarea
17        _ovride ...
18        zstr heap
19    eof
20 */
21 
22 
23 /* This key is present at the beginning of an area file.  MAREA_ID is
24  * used for the message data file and FAREA_ID is used for the
25  * file data file.
26  */
27 
28 #define MAREA_ID      0x1a49023fL
29 #define FAREA_ID      0x1a01953aL
30 
31 #define ADATA_START   4L          /* The area data info starts at offset 4 */
32 
33 typedef struct _ovride
34 {
35   /* Only one of 'opt' or 'name' should be used.  If opt==0, use name.  If  *
36    * name==0, use opt.                                                      */
37 
38   option opt;           /* Type of menu option to override     ...OR...     */
39   byte   name;          /* First letter of command to override              */
40   byte   rsvd1;         /* Reserved for future use                          */
41   zstr   acs;           /* New ACS required to access option                */
42   zstr   menuname;      /* Use this access level on the given menu only     */
43 } OVERRIDE;
44 
45 
46 /* Bit masks for the ma.attribs field */
47 
48 #define MA_PVT      0x0001  /* Private msgs allowed */
49 #define MA_PUB      0x0002  /* Public msgs allowed */
50 #define MA_HIBIT    0x0004  /* High bit msgs allowed */
51 
52 #define MA_NET      0x0008  /* Netmail area */
53 #define MA_ECHO     0x0010  /* Echomail area */
54 #define MA_CONF     0x0020  /* Conference area */
55 
56 #define MA_ANON     0x0040  /* Anonymous messages are OK */
57 #define MA_NORNK    0x0080  /* Don't use the REALNAME kludge for this area */
58 #define MA_REAL     0x0100  /* Force  use of       real name for this area */
59 #define MA_ALIAS    0x0200  /* Force  use of alias      name for this area */
60 #define MA_AUDIT    0x0400  /* Use auditing (msg tracking) controls in area*/
61 #define MA_READONLY 0x0800  /* Area is read-only */
62 #define MA_HIDDN    0x1000  /* Area does not display on normal area list   */
63 #define MA_ATTACH   0x2000  /* Area allows local file attaches             */
64 #define MA_DIVBEGIN 0x4000  /* A message area division, not a real area    */
65 #define MA_DIVEND   0x8000  /* End of the message area division            */
66 
67 #define MA2_NOMCHK  0x0001  /* Don't do personal mail check in this area   */
68 
69 #define MA_SHARED   (MA_ECHO | MA_CONF)
70 
71 
72 /* Bit masks for fa.attribs */
73 
74 #define FA_SLOW     0x0001  /* Slow-access medium: skip existence checks */
75 #define FA_STAGED   0x0002  /* Used staged transfer area for downloads */
76 #define FA_NONEW    0x0004  /* Permanent storage - skip for new file checks */
77 #define FA_HIDDN    0x0008  /* Area does not display on normal area list */
78 #define FA_DIVBEGIN 0x4000  /* A file area division, not a real area */
79 #define FA_DIVEND   0x8000  /* End of file area division */
80 #define FA_AUTODATE 0x0010  /* Auto-date override */
81 #define FA_MANDATE  0x0020  /* Manual date override */
82 #define FA_LISTDATE 0x0040  /* List-date override */
83 #define FA_FREETIME 0x0100  /* Free download time for all files */
84 #define FA_FREESIZE 0x0200  /* Free download bytes for all files */
85 #define FA_NOINDEX  0x0400  /* Don't add this area to maxfiles.idx */
86 
87 #define FA_CDROM    (FA_SLOW | FA_STAGED | FA_NONEW)
88 #define FA_FREEALL  (FA_FREETIME | FA_FREESIZE)
89 
90 typedef struct _msgarea
91 {
92   word cbArea;          /* Length of THIS INDIVIDUAL RECORD                0*/
93   word num_override;    /* Number of overrides following this record       2*/
94   word cbHeap;          /* Length of the zstr heap following the overrides 4*/
95   word division;        /* Reserved for future use                         6*/
96   zstr name;            /* String format of area's name.                   8*/
97   zstr acs;             /* Access control string for this area            10*/
98   zstr path;            /* Path to messages (but for MA_DIVBEGIN only,    12*
99                          * used instead as name of custom .bbs file).       */
100   zstr echo_tag;        /* The 'tag' of the area, for use in ECHOTOSS.LOG 14*/
101   zstr descript;        /* The DIR.BBS-like description for msg section   16*/
102   zstr origin;          /* The ORIGIN line for this area                  18*/
103   zstr menuname;        /* Custom menu name                               20*/
104   zstr menureplace;     /* Replace this menu name with menuname from above22*/
105 
106   word attribs;         /* Attributes for this area                       24*/
107 
108   NETADDR primary;      /* Use as primary address for this area           26*/
109   NETADDR seenby;       /* Use as address in seen-bys                     34*/
110   word attribs_2;       /* More attributes                                42*/
111   word type;            /* Message base type.  MSGTYPE_SDM = *.MSG.       44*
112                          * MSGTYPE_SQUISH = SquishMail.  (Constants are     *
113                          * in MSGAPI.H)                                     */
114   word killbyage;       /* Make sure msgs are less than X days old        46*/
115   word killbynum;       /* Make sure there are less than X msgs           48*/
116   word killskip;        /* Exempt the first X msgs from this processing   50*/
117   zstr barricade;       /* Barricade file                                 52*/
118   zstr barricademenu;   /* Apply barricade priv while using this menu     54*/
119   sdword cbPrior;       /* Seek offset from start of this area to get back56*
120                          * to prior area.                                   */
121   zstr attachpath;      /* Reserved for future use                        58*/
122   dword rsvd4;                                                          /*60*/
123 } MAREA;                                                                /*64*/
124 
125 
126 typedef struct _filearea
127 {
128   word cbArea;          /* Length of THIS INDIVIDUAL RECORD                0*/
129   word num_override;    /* Number of overrides following this record       2*/
130   word cbHeap;          /* Length of the zstr heap following the overrides 4*/
131   word division;        /* Reserved for future use                         6*/
132 
133   zstr acs;             /* Access control string for this area             8*/
134   zstr name;            /* String format of area's name.                  10*/
135   zstr downpath;        /* Path for downloads.                            12*/
136   zstr uppath;          /* Path for uploads                               14*/
137   zstr filesbbs;        /* Path to FILES.BBS-like catalog for this area   16*
138                          * (For FA_DIVBEGIN only, also used as name of      *
139                          * custom .bbs display file.)                       */
140   zstr descript;        /* The DIR.BBS-like description for file section  18*/
141   zstr menuname;        /* Custom menu for this file area                 20*/
142   zstr menureplace;     /* Replace this menu name with menuname from above22*/
143   zstr barricade;       /* Barricade file                                 24*/
144   zstr barricademenu;   /* Barricade file                                 26*/
145   sdword cbPrior;       /* Offset to prior area                           28*/
146   word attribs;         /* Attributes for this file area                  32*/
147   sword date_style;     /* Date style override for this area              34*/
148   byte rsvd1[28];       /* Reserved by Maximus for future use             36*/
149 } FAREA;                                                                /*64*/
150 
151 
152 typedef struct _barinfo
153 {
154   int use_barpriv;            /* Use the privs in this structure? */
155   word priv;                  /* New priv level to use while in this area */
156   dword keys;                 /* New keys to use while in this area */
157 } BARINFO;
158 
159 /* In-memory handles for accessing message and file areas */
160 
161 typedef struct _mahandle
162 {
163   OVERRIDE *pov;
164   char *heap;
165   MAREA ma;
166   int heap_size;
167 
168   BARINFO bi;
169 } MAH, *PMAH;
170 
171 struct FAH
172 {
173   OVERRIDE *pov;
174   char *heap;
175   FAREA fa;
176   int heap_size;
177 
178   BARINFO bi;
179 };
180 
181 
182 /* Macros for accessing the zstr values of the MAH/FAH structures. */
183 
184 #define MAS(ah, var) ((ah).heap + (ah).ma.var)
185 #define PMAS(ah, var) ((ah)->heap + (ah)->ma.var)
186 
187 #define FAS(ah, var) ((ah).heap + (ah).fa.var)
188 #define PFAS(ah, var) ((ah)->heap + (ah)->fa.var)
189 
190 
191 /* Index structure for message/file areas */
192 
193 typedef struct _mfidx
194 {
195   char name[16];        /* First 15 chars of area name                      */
196   dword name_hash;      /* SquishHash of full area name                     */
197   dword ofs;            /* Offset within data file                          */
198 } MFIDX;
199 
200 #endif /* __NEWAREA_H_DEFINED */
201 
202 
203