2 Internal header file for the uuconf package.
4 Copyright (C) 1992, 1993, 1994, 1995 Ian Lance Taylor
6 This file is part of the Taylor UUCP uuconf library.
8 This library is free software; you can redistribute it and/or
9 modify it under the terms of the GNU Library General Public License
10 as published by the Free Software Foundation; either version 2 of
11 the License, or (at your option) any later version.
13 This library is distributed in the hope that it will be useful, but
14 WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 Library General Public License for more details.
18 You should have received a copy of the GNU Library General Public
19 License along with this library; if not, write to the Free Software
20 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22 The author of the program may be contacted at ian@airs.com or
23 c/o Cygnus Support, 48 Grove Street, Somerville, MA 02144.
26 /* This is the internal header file for the uuconf package. It should
27 not be included by anything other than the uuconf code itself. */
29 /* Get all the general definitions. */
32 /* Get the uuconf header file itself. */
35 /* We need the system dependent header file. */
38 /* This is the generic information structure. This holds all the
39 per-thread global information needed by the uuconf code. The
40 per-process global information is held in an sprocess structure,
41 which this structure points to. This permits the code to not have
42 any global variables at all. */
46 /* A pointer to the per-process global information. */
47 struct sprocess *qprocess;
48 /* A memory block in which all the memory for these fields is
51 /* The value of errno after an error. */
53 /* The filename for which an error occurred. */
54 const char *zfilename;
55 /* The line number at which an error occurred. */
59 /* This is the per-process information structure. This essentially
60 holds all the global variables used by uuconf. */
64 /* The name of the local machine. This will be NULL if it is not
65 specified in a configuration file. */
66 const char *zlocalname;
67 /* The spool directory. */
68 const char *zspooldir;
69 /* The default public directory. */
71 /* The lock directory. */
75 /* The statistics file. */
76 const char *zstatsfile;
77 /* The debugging file. */
78 const char *zdebugfile;
79 /* The default debugging level. */
81 /* Whether login information should be stripped. */
83 /* Whether protocol information should be stripped. */
85 /* The maximum number of simultaneously executing uuxqts. */
87 /* How often to spawn a uuxqt process. */
88 const char *zrunuuxqt;
89 /* Whether we are reading the V2 configuration files. */
91 /* Whether we are reading the HDB configuration files. */
93 /* The names of the dialcode files. */
94 char **pzdialcodefiles;
95 /* Timetables. These are in pairs. The first element is the name,
96 the second is the time string. */
99 /* Taylor UUCP config file name. */
101 /* Taylor UUCP sys file names. */
103 /* Taylor UUCP port file names. */
105 /* Taylor UUCP dial file names. */
107 /* Taylor UUCP passwd file names. */
109 /* Taylor UUCP call file names. */
111 /* List of "unknown" commands from config file. */
112 struct sunknown *qunknown;
113 /* Whether the Taylor UUCP system information locations have been
115 boolean fread_syslocs;
116 /* Taylor UUCP system information locations. */
117 struct stsysloc *qsyslocs;
118 /* Taylor UUCP validation restrictions. */
119 struct svalidate *qvalidate;
120 /* Whether the "myname" command is used in a Taylor UUCP file. */
121 boolean fuses_myname;
123 /* V2 system file name (L.sys). */
125 /* V2 device file name (L-devices). */
127 /* V2 user permissions file name (USERFILE). */
129 /* V2 user permitted commands file (L.cmds). */
132 /* HDB system file names (Systems). */
133 char **pzhdb_systems;
134 /* HDB device file names (Devices). */
135 char **pzhdb_devices;
136 /* HDB dialer file names (Dialers). */
137 char **pzhdb_dialers;
138 /* Whether the HDB Permissions file has been read. */
139 boolean fhdb_read_permissions;
140 /* The HDB Permissions file entries. */
141 struct shpermissions *qhdb_permissions;
144 /* This structure is used to hold the "unknown" commands from the
145 Taylor UUCP config file before they have been parsed. */
149 /* Next element in linked list. */
150 struct sunknown *qnext;
151 /* Line number in config file. */
153 /* Number of arguments. */
159 /* This structure is used to hold the locations of systems within the
160 Taylor UUCP sys files. */
164 /* Next element in linked list. */
165 struct stsysloc *qnext;
168 /* Whether system is an alias or a real system. If this is an
169 alias, the real system is the next entry in the linked list which
172 /* File name (one of the sys files). */
176 /* Location within file (from ftell). */
178 /* Line number within file. */
182 /* This structure is used to hold validation restrictions. This is a
183 list of machines which are permitted to use a particular login
184 name. If a machine logs in, and there is no called login entry for
185 it, the login name and machine name must be passed to
186 uuconf_validate to confirm that either there is no entry for this
187 login name or that the machine name appears on the entry. */
191 /* Next element in linked list. */
192 struct svalidate *qnext;
194 const char *zlogname;
195 /* NULL terminated list of machine names. */
199 /* This structure is used to hold a linked list of HDB Permissions
204 /* Next entry in linked list. */
205 struct shpermissions *qnext;
206 /* NULL terminated array of LOGNAME values. */
208 /* NULL terminated array of MACHINE values. */
210 /* Boolean REQUEST value. */
212 /* Boolean SENDFILES value ("call" is taken as "no"). */
214 /* NULL terminated array of READ values. */
216 /* NULL terminated array of WRITE values. */
218 /* Boolean CALLBACK value. */
220 /* NULL terminated array of COMMANDS values. */
222 /* NULL terminated array of VALIDATE values. */
224 /* String MYNAME value. */
226 /* String PUBDIR value. */
228 /* NULL terminated array of ALIAS values. */
232 /* This structure is used to build reentrant uuconf_cmdtab tables.
233 The ioff field is either (size_t) -1 or an offsetof macro. The
234 table is then copied into a uuconf_cmdtab, except that offsets of
235 (size_t) -1 are converted to pvar elements of NULL, and other
236 offsets are converted to an offset off some base address. */
243 uuconf_cmdtabfn pifn;
246 /* A value in a uuconf_system structure which holds the address of
247 this special variable is known to be uninitialized. */
248 extern char *_uuconf_unset;
250 /* Internal function to read a system from the Taylor UUCP
251 configuration files. This does not apply the basic defaults. */
252 extern int _uuconf_itaylor_system_internal P((struct sglobal *qglobal,
254 struct uuconf_system *qsys));
256 /* Read the system locations and validation information from the
257 Taylor UUCP configuration files. This sets the qsyslocs,
258 qvalidate, and fread_syslocs elements of the global structure. */
259 extern int _uuconf_iread_locations P((struct sglobal *qglobal));
261 /* Process a command for a port from a Taylor UUCP file. */
262 extern int _uuconf_iport_cmd P((struct sglobal *qglobal, int argc,
263 char **argv, struct uuconf_port *qport));
265 /* Process a command for a dialer from a Taylor UUCP file. */
266 extern int _uuconf_idialer_cmd P((struct sglobal *qglobal, int argc,
268 struct uuconf_dialer *qdialer));
270 /* Process a command for a chat script from a Taylor UUCP file; this
271 is also called for HDB or V2 files, with a made up command. */
272 extern int _uuconf_ichat_cmd P((struct sglobal *qglobal, int argc,
273 char **argv, struct uuconf_chat *qchat,
276 /* Process a protocol-parameter command from a Taylor UUCP file. */
277 extern int _uuconf_iadd_proto_param P((struct sglobal *qglobal,
278 int argc, char **argv,
279 struct uuconf_proto_param **pq,
282 /* Handle a "seven-bit", "reliable", or "half-duplex" command from a
283 Taylor UUCP port or dialer file. The pvar field should point to
284 the ireliable element of the structure. */
285 extern int _uuconf_iseven_bit P((pointer pglobal, int argc, char **argv,
286 pointer pvar, pointer pinfo));
287 extern int _uuconf_ireliable P((pointer pglobal, int argc, char **argv,
288 pointer pvar, pointer pinfo));
289 extern int _uuconf_ihalf_duplex P((pointer pglobal, int argc, char **argv,
290 pointer pvar, pointer pinfo));
292 /* Internal function to read a system from the V2 configuration files.
293 This does not apply the basic defaults. */
294 extern int _uuconf_iv2_system_internal P((struct sglobal *qglobal,
296 struct uuconf_system *qsys));
298 /* Internal function to read a system from the HDB configuration
299 files. This does not apply the basic defaults. */
300 extern int _uuconf_ihdb_system_internal P((struct sglobal *qglobal,
302 struct uuconf_system *qsys));
304 /* Read the HDB Permissions file. */
305 extern int _uuconf_ihread_permissions P((struct sglobal *qglobal));
307 /* Initialize the global information structure. */
308 extern int _uuconf_iinit_global P((struct sglobal **pqglobal));
310 /* Clear system information. */
311 extern void _uuconf_uclear_system P((struct uuconf_system *qsys));
313 /* Default unset aspects of one system to the contents of another. */
314 extern int _uuconf_isystem_default P((struct sglobal *qglobal,
315 struct uuconf_system *q,
316 struct uuconf_system *qdefault,
317 boolean faddalternates));
319 /* Put in the basic system defaults. */
320 extern int _uuconf_isystem_basic_default P((struct sglobal *qglobal,
321 struct uuconf_system *qsys));
323 /* Clear port information. */
324 extern void _uuconf_uclear_port P((struct uuconf_port *qport));
326 /* Clear dialer information. */
327 extern void _uuconf_uclear_dialer P((struct uuconf_dialer *qdialer));
329 /* Add a timetable. */
330 extern int _uuconf_itimetable P((pointer pglobal, int argc, char **argv,
331 pointer pvar, pointer pinfo));
333 /* Parse a time string. */
334 extern int _uuconf_itime_parse P((struct sglobal *qglobal, char *ztime,
335 long ival, int cretry,
336 int (*picmp) P((long, long)),
337 struct uuconf_timespan **pqspan,
340 /* A grade comparison function to pass to _uuconf_itime_parse. */
341 extern int _uuconf_itime_grade_cmp P((long, long));
343 /* Parse a debugging string. */
345 extern int _uuconf_idebug_cmd P((struct sglobal *qglobal,
346 char **pzdebug, int argc,
347 char **argv, pointer pblock));
349 /* Add a string to a NULL terminated list of strings. */
350 extern int _uuconf_iadd_string P((struct sglobal *qglobal,
351 char *zadd, boolean fcopy,
352 boolean fdupcheck, char ***ppzstrings,
355 /* Parse a string into a boolean value. */
356 extern int _uuconf_iboolean P((struct sglobal *qglobal, const char *zval,
359 /* Parse a string into an integer value. The argument p is either an
360 int * or a long *, according to the argument fint. */
361 extern int _uuconf_iint P((struct sglobal *qglobal, const char *zval,
362 pointer p, boolean fint));
364 /* Turn a cmdtab_offset table into a uuconf_cmdtab table. */
365 extern void _uuconf_ucmdtab_base P((const struct cmdtab_offset *qoff,
366 size_t celes, char *pbase,
367 struct uuconf_cmdtab *qset));
369 /* Merge two memory blocks into one. This cannot fail. */
370 extern pointer _uuconf_pmalloc_block_merge P((pointer, pointer));
372 /* A wrapper for getline that continues lines if they end in a
373 backslash. It needs qglobal so that it can increment ilineno
375 extern int _uuconf_getline P((struct sglobal *qglobal,
376 char **, size_t *, FILE *));
378 /* Split a string into tokens. */
379 extern int _uuconf_istrsplit P((char *zline, int bsep,
380 char ***ppzsplit, size_t *csplit));