|
|
1.1 root 1: /* uucnfi.h
2: Internal header file for the uuconf package.
3:
4: Copyright (C) 1992 Ian Lance Taylor
5:
6: This file is part of the Taylor UUCP uuconf library.
7:
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.
12:
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.
17:
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., 675 Mass Ave, Cambridge, MA 02139, USA.
21:
22: The author of the program may be contacted at [email protected] or
23: c/o Infinity Development Systems, P.O. Box 520, Waltham, MA 02254.
24: */
25:
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. */
28:
29: /* Get all the general definitions. */
30: #include "uucp.h"
31:
32: /* Get the uuconf header file itself. */
33: #include "uuconf.h"
34:
35: /* We need the system dependent header file. */
36: #include "syshdr.h"
37:
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. */
43:
44: struct sglobal
45: {
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
49: allocated. */
50: pointer pblock;
51: /* The value of errno after an error. */
52: int ierrno;
53: /* The filename for which an error occurred. */
54: const char *zfilename;
55: /* The line number at which an error occurred. */
56: int ilineno;
57: };
58:
59: /* This is the per-process information structure. This essentially
60: holds all the global variables used by uuconf. */
61:
62: struct sprocess
63: {
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. */
70: const char *zpubdir;
71: /* The lock directory. */
72: const char *zlockdir;
73: /* The log file. */
74: const char *zlogfile;
75: /* The statistics file. */
76: const char *zstatsfile;
77: /* The debugging file. */
78: const char *zdebugfile;
79: /* The default debugging level. */
80: const char *zdebug;
81: /* The maximum number of simultaneously executing uuxqts. */
82: int cmaxuuxqts;
83: /* Whether we are reading the V2 configuration files. */
84: boolean fv2;
85: /* Whether we are reading the HDB configuration files. */
86: boolean fhdb;
87: /* The names of the dialcode files. */
88: char **pzdialcodefiles;
89: /* Timetables. These are in pairs. The first element is the name,
90: the second is the time string. */
91: char **pztimetables;
92:
93: /* Taylor UUCP config file name. */
94: char *zconfigfile;
95: /* Taylor UUCP sys file names. */
96: char **pzsysfiles;
97: /* Taylor UUCP port file names. */
98: char **pzportfiles;
99: /* Taylor UUCP dial file names. */
100: char **pzdialfiles;
101: /* Taylor UUCP passwd file names. */
102: char **pzpwdfiles;
103: /* Taylor UUCP call file names. */
104: char **pzcallfiles;
105: /* List of "unknown" commands from config file. */
106: struct sunknown *qunknown;
107: /* Whether the Taylor UUCP system information locations have been
108: read. */
109: boolean fread_syslocs;
110: /* Taylor UUCP system information locations. */
111: struct stsysloc *qsyslocs;
112: /* Taylor UUCP validation restrictions. */
113: struct svalidate *qvalidate;
114: /* Whether the "myname" command is used in a Taylor UUCP file. */
115: boolean fuses_myname;
116:
117: /* V2 system file name (L.sys). */
118: char *zv2systems;
119: /* V2 device file name (L-devices). */
120: char *zv2devices;
121: /* V2 user permissions file name (USERFILE). */
122: char *zv2userfile;
123: /* V2 user permitted commands file (L.cmds). */
124: char *zv2cmds;
125:
126: /* HDB system file names (Systems). */
127: char **pzhdb_systems;
128: /* HDB device file names (Devices). */
129: char **pzhdb_devices;
130: /* HDB dialer file names (Dialers). */
131: char **pzhdb_dialers;
132: /* Whether the HDB Permissions file has been read. */
133: boolean fhdb_read_permissions;
134: /* The HDB Permissions file entries. */
135: struct shpermissions *qhdb_permissions;
136: };
137:
138: /* This structure is used to hold the "unknown" commands from the
139: Taylor UUCP config file before they have been parsed. */
140:
141: struct sunknown
142: {
143: /* Next element in linked list. */
144: struct sunknown *qnext;
145: /* Line number in config file. */
146: int ilineno;
147: /* Number of arguments. */
148: int cargs;
149: /* Arguments. */
150: char **pzargs;
151: };
152:
153: /* This structure is used to hold the locations of systems within the
154: Taylor UUCP sys files. */
155:
156: struct stsysloc
157: {
158: /* Next element in linked list. */
159: struct stsysloc *qnext;
160: /* System name. */
161: const char *zname;
162: /* Whether system is an alias or a real system. If this is an
163: alias, the real system is the next entry in the linked list which
164: is not an alias. */
165: boolean falias;
166: /* File name (one of the sys files). */
167: const char *zfile;
168: /* Open file. */
169: FILE *e;
170: /* Location within file (from ftell). */
171: long iloc;
172: /* Line number within file. */
173: int ilineno;
174: };
175:
176: /* This structure is used to hold validation restrictions. This is a
177: list of machines which are permitted to use a particular login
178: name. If a machine logs in, and there is no called login entry for
179: it, the login name and machine name must be passed to
180: uuconf_validate to confirm that either there is no entry for this
181: login name or that the machine name appears on the entry. */
182:
183: struct svalidate
184: {
185: /* Next element in linked list. */
186: struct svalidate *qnext;
187: /* Login name. */
188: const char *zlogname;
189: /* NULL terminated list of machine names. */
190: char **pzmachines;
191: };
192:
193: /* This structure is used to hold a linked list of HDB Permissions
194: file entries. */
195:
196: struct shpermissions
197: {
198: /* Next entry in linked list. */
199: struct shpermissions *qnext;
200: /* NULL terminated array of LOGNAME values. */
201: char **pzlogname;
202: /* NULL terminated array of MACHINE values. */
203: char **pzmachine;
204: /* Boolean REQUEST value. */
205: int frequest;
206: /* Boolean SENDFILES value ("call" is taken as "no"). */
207: int fsendfiles;
208: /* NULL terminated array of READ values. */
209: char **pzread;
210: /* NULL terminated array of WRITE values. */
211: char **pzwrite;
212: /* Boolean CALLBACK value. */
213: int fcallback;
214: /* NULL terminated array of COMMANDS values. */
215: char **pzcommands;
216: /* NULL terminated array of VALIDATE values. */
217: char **pzvalidate;
218: /* String MYNAME value. */
219: char *zmyname;
220: /* String PUBDIR value. */
221: const char *zpubdir;
222: /* NULL terminated array of ALIAS values. */
223: char **pzalias;
224: };
225:
226: /* This structure is used to build reentrant uuconf_cmdtab tables.
227: The ioff field is either (size_t) -1 or an offsetof macro. The
228: table is then copied into a uuconf_cmdtab, except that offsets of
229: (size_t) -1 are converted to pvar elements of NULL, and other
230: offsets are converted to an offset off some base address. */
231:
232: struct cmdtab_offset
233: {
234: const char *zcmd;
235: int itype;
236: size_t ioff;
237: uuconf_cmdtabfn pifn;
238: };
239:
240: /* A value in a uuconf_system structure which holds the address of
241: this special variable is known to be uninitialized. */
242: extern char *_uuconf_unset;
243:
244: /* Internal function to read a system from the Taylor UUCP
245: configuration files. This does not apply the basic defaults. */
246: extern int _uuconf_itaylor_system_internal P((struct sglobal *qglobal,
247: const char *zsystem,
248: struct uuconf_system *qsys));
249:
250: /* Read the system locations and validation information from the
251: Taylor UUCP configuration files. This sets the qsyslocs,
252: qvalidate, and fread_syslocs elements of the global structure. */
253: extern int _uuconf_iread_locations P((struct sglobal *qglobal));
254:
255: /* Process a command for a port from a Taylor UUCP file. */
256: extern int _uuconf_iport_cmd P((struct sglobal *qglobal, int argc,
257: char **argv, struct uuconf_port *qport));
258:
259: /* Process a command for a dialer from a Taylor UUCP file. */
260: extern int _uuconf_idialer_cmd P((struct sglobal *qglobal, int argc,
261: char **argv,
262: struct uuconf_dialer *qdialer));
263:
264: /* Process a command for a chat script from a Taylor UUCP file; this
265: is also called for HDB or V2 files, with a made up command. */
266: extern int _uuconf_ichat_cmd P((struct sglobal *qglobal, int argc,
267: char **argv, struct uuconf_chat *qchat,
268: pointer pblock));
269:
270: /* Process a protocol-parameter command from a Taylor UUCP file. */
271: extern int _uuconf_iadd_proto_param P((struct sglobal *qglobal,
272: int argc, char **argv,
273: struct uuconf_proto_param **pq,
274: pointer pblock));
275:
276: /* Handle a "seven-bit", "reliable", or "half-duplex" command from a
277: Taylor UUCP port or dialer file. The pvar field should point to
278: the ireliable element of the structure. */
279: extern int _uuconf_iseven_bit P((pointer pglobal, int argc, char **argv,
280: pointer pvar, pointer pinfo));
281: extern int _uuconf_ireliable P((pointer pglobal, int argc, char **argv,
282: pointer pvar, pointer pinfo));
283: extern int _uuconf_ihalf_duplex P((pointer pglobal, int argc, char **argv,
284: pointer pvar, pointer pinfo));
285:
286: /* Internal function to read a system from the V2 configuration files.
287: This does not apply the basic defaults. */
288: extern int _uuconf_iv2_system_internal P((struct sglobal *qglobal,
289: const char *zsystem,
290: struct uuconf_system *qsys));
291:
292: /* Internal function to read a system from the HDB configuration
293: files. This does not apply the basic defaults. */
294: extern int _uuconf_ihdb_system_internal P((struct sglobal *qglobal,
295: const char *zsystem,
296: struct uuconf_system *qsys));
297:
298: /* Read the HDB Permissions file. */
299: extern int _uuconf_ihread_permissions P((struct sglobal *qglobal));
300:
301: /* Initialize the global information structure. */
302: extern int _uuconf_iinit_global P((struct sglobal **pqglobal));
303:
304: /* Clear system information. */
305: extern void _uuconf_uclear_system P((struct uuconf_system *qsys));
306:
307: /* Default unset aspects of one system to the contents of another. */
308: extern int _uuconf_isystem_default P((struct sglobal *qglobal,
309: struct uuconf_system *q,
310: struct uuconf_system *qdefault,
311: boolean faddalternates));
312:
313: /* Put in the basic system defaults. */
314: extern int _uuconf_isystem_basic_default P((struct sglobal *qglobal,
315: struct uuconf_system *qsys));
316:
317: /* Clear port information. */
318: extern void _uuconf_uclear_port P((struct uuconf_port *qport));
319:
320: /* Clear dialer information. */
321: extern void _uuconf_uclear_dialer P((struct uuconf_dialer *qdialer));
322:
323: /* Add a timetable. */
324: extern int _uuconf_itimetable P((pointer pglobal, int argc, char **argv,
325: pointer pvar, pointer pinfo));
326:
327: /* Parse a time string. */
328: extern int _uuconf_itime_parse P((struct sglobal *qglobal, char *ztime,
329: long ival, int cretry,
330: int (*picmp) P((long, long)),
331: struct uuconf_timespan **pqspan,
332: pointer pblock));
333:
334: /* A grade comparison function to pass to _uuconf_itime_parse. */
335: extern int _uuconf_itime_grade_cmp P((long, long));
336:
337: /* Add a string to a NULL terminated list of strings. */
338: extern int _uuconf_iadd_string P((struct sglobal *qglobal,
339: char *zadd, boolean fcopy,
340: boolean fdupcheck, char ***ppzstrings,
341: pointer pblock));
342:
343: /* Parse a string into a boolean value. */
344: extern int _uuconf_iboolean P((struct sglobal *qglobal, const char *zval,
345: int *pi));
346:
347: /* Parse a string into an integer value. The argument p is either an
348: int * or a long *, according to the argument fint. */
349: extern int _uuconf_iint P((struct sglobal *qglobal, const char *zval,
350: pointer p, boolean fint));
351:
352: /* Turn a cmdtab_offset table into a uuconf_cmdtab table. */
353: extern void _uuconf_ucmdtab_base P((const struct cmdtab_offset *qoff,
354: size_t celes, char *pbase,
355: struct uuconf_cmdtab *qset));
356:
357: /* Merge two memory blocks into one. This cannot fail. */
358: extern pointer _uuconf_pmalloc_block_merge P((pointer, pointer));
359:
360: /* A wrapper for getline that continues lines if they end in a
361: backslash. It needs qglobal so that it can increment ilineno
362: correctly. */
363: extern int _uuconf_getline P((struct sglobal *qglobal,
364: char **, size_t *, FILE *));
365:
366: /* Split a string into tokens. */
367: extern int _uuconf_istrsplit P((char *zline, int bsep,
368: char ***ppzsplit, size_t *csplit));
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.