-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathuuconf.h
1607 lines (1399 loc) · 66.9 KB
/
uuconf.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/* uuconf.h
Header file for UUCP configuration routines.
Copyright (C) 1992, 1993, 1994, 1995, 2002 Ian Lance Taylor
This file is part of the Taylor UUCP uuconf library.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License
as published by the Free Software Foundation; either version 2 of
the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
The use of an object file which uses material from this header
file, and from no other portion of the uuconf library, is
unrestricted, as described in paragraph 4 of section 5 of version 2
of the GNU Library General Public License (this sentence is merely
informative, and does not modify the License in any way).
The author of the program may be contacted at [email protected].
*/
#ifndef UUCONF_H
#define UUCONF_H
#include <stdio.h>
/* The macro UUCONF_ANSI_C may be used to override __STDC__. */
#ifndef UUCONF_ANSI_C
#ifdef __STDC__
#define UUCONF_ANSI_C 1
#else /* ! defined (__STDC__) */
#define UUCONF_ANSI_C 0
#endif /* ! defined (__STDC__) */
#endif /* ! defined (UUCONF_ANSI_C) */
#if UUCONF_ANSI_C
#define UUCONF_CONST const
typedef void *UUCONF_POINTER;
#include <stddef.h>
typedef size_t UUCONF_SIZE_T;
#else
#define UUCONF_CONST
typedef char *UUCONF_POINTER;
typedef unsigned int UUCONF_SIZE_T;
#endif
/* The field names of each of the following structures begin with
"uuconf_". This is to avoid any conflicts with user defined
macros. The first character following the "uuconf_" string
indicates the type of the field.
z -- a string (char *)
c -- a count (normally int)
i -- an integer value (normally int)
f -- a boolean value (normally int)
b -- a single character value (char or int)
t -- an enum (enum XX)
s -- a structure (struct XX)
u -- a union (union XX)
q -- a pointer to a structure (struct XX *)
p -- a pointer to something other than a string
*/
/* The information which is kept for a chat script. */
struct uuconf_chat
{
/* The script itself. This is a NULL terminated list of expect/send
pairs. The first string is an expect string. A string starting
with a '-' indicates subsend string; the following strings which
start with '-' are subexpect/subsend strings. This field may be
NULL, in which case there is no chat script (but pzprogram may
hold a program to run). */
char **uuconf_pzchat;
/* The chat program to run. This is a NULL terminated list of
arguments; element 0 is the program. May be NULL, in which case
there is no program. */
char **uuconf_pzprogram;
/* The timeout in seconds to use for expect strings in the chat
script. */
int uuconf_ctimeout;
/* The NULL terminated list of failure strings. If any of these
strings appear, the chat script is aborted. May be NULL, in
which case there are no failure strings. */
char **uuconf_pzfail;
/* Non-zero if incoming characters should be stripped to seven bits
(by anding with 0x7f). */
int uuconf_fstrip;
};
/* The information which is kept for a time specification. This is a
linked list of structures. Each element of the list represents a
span of time, giving a starting time and an ending time. The time
only depends on the day of the week, not on the day of the month or
of the year. The time is only specified down to the minute, not
down to the second or below. The list is sorted by starting time.
The starting and ending time are expressed in minutes since the
beginning of the week, which is considered to be 12 midnight on
Sunday. Thus 60 is 1 am on Sunday, 1440 (== 60 * 24) is 12
midnight on Monday, and the largest possible value is 10080 (== 60
* 24 * 7) which is 12 midnight on the following Sunday.
Each span of time has a value associated with it. This is the
lowest grade or the largest file size that may be transferred
during that time, depending on the source of the time span. When
time specifications overlap, the value used for the overlap is the
higher grade or the smaller file size. Thus specifying
``call-timegrade z Any'' and ``call-timegrade Z Mo'' means that
only grade Z or higher may be sent on Monday, since Z is the higer
grade of the overlapping spans. The final array wil have no
overlaps.
Each span also has a retry time associated with it. This permits
different retry times to be used at different times of day. The
retry time is only relevant if the span came from a ``time'' or
``timegrade'' command for a system. */
struct uuconf_timespan
{
/* Next element in list. */
struct uuconf_timespan *uuconf_qnext;
/* Starting minute (-1 at the end of the array). */
int uuconf_istart;
/* Ending minute. */
int uuconf_iend;
/* Value for this span (lowest grade or largest file that may be
transferred at this time). */
long uuconf_ival;
/* Retry time. */
int uuconf_cretry;
};
/* The information which is kept for protocol parameters. Protocol
parameter information is stored as an array of the following
structures. */
struct uuconf_proto_param
{
/* The name of the protocol to which this entry applies. This is
'\0' for the last element of the array. */
int uuconf_bproto;
/* Specific entries for this protocol. This points to an array
ending in an element with a uuconf_cargs field of 0. */
struct uuconf_proto_param_entry *uuconf_qentries;
};
/* Each particular protocol parameter entry is one of the following
structures. */
struct uuconf_proto_param_entry
{
/* The number of arguments to the ``protocol-parameter'' command
(not counting ``protocol-parameter'' itself). This is 0 for the
last element of the array. */
int uuconf_cargs;
/* The actual arguments to the ``protocol-parameter'' command; this
is an array with cargs entries. */
char **uuconf_pzargs;
};
/* The information which is kept for a system. The zname and zalias
fields will be the same for all alternates. Every other fields is
specific to the particular alternate in which it appears (although
most will be the same for all alternates). */
struct uuconf_system
{
/* The name of the system. */
char *uuconf_zname;
/* A list of aliases for the system. This is a NULL terminated list
of strings. May be NULL, in which case there are no aliases. */
char **uuconf_pzalias;
/* A linked list of alternate call in or call out information. Each
alternative way to call this system occupies an element of this
list. May be NULL, in which case there are no alternates. */
struct uuconf_system *uuconf_qalternate;
/* The name for this particular alternate. May be NULL, in which
case this alternate does not have a name. */
char *uuconf_zalternate;
/* If non-zero, this alternate may be used for calling out. */
int uuconf_fcall;
/* If non-zero, this alternate may be used for accepting a call. */
int uuconf_fcalled;
/* The times at which this system may be called. The ival field of
each uuconf_timespan structure is the lowest grade which may be
transferred at that time. The cretry field is the number of
minutes to wait before retrying the call, or 0 if it was not
specified. May be NULL, in which case the system may never be
called. */
struct uuconf_timespan *uuconf_qtimegrade;
/* The times at which to request a particular grade of the system
when calling it, and the grades to request. The ival field of
each uuconf_timespan structure is the lowest grade which the
other system should transfer at that time. May be NULL, in which
case there are no grade restrictions. */
struct uuconf_timespan *uuconf_qcalltimegrade;
/* The times at which to allow a particular grade of work to be
transferred to the system, when it calls in. The ival field of
each uuconf_timespan structure is the lowest grade which should
be transferred at that time. May be NULL, in which case there
are no grade restrictions. */
struct uuconf_timespan *uuconf_qcalledtimegrade;
/* The maximum number of times to retry calling this system. If
this is 0, there is no limit. */
int uuconf_cmax_retries;
/* The number of minutes to wait between successful calls to a
system. */
int uuconf_csuccess_wait;
/* The size restrictions by time for local requests during a locally
placed call. The ival field of each uuconf_timespan structure is
the size in bytes of the largest file which may be transferred at
that time. May be NULL, in which case there are no size
restrictions. */
struct uuconf_timespan *uuconf_qcall_local_size;
/* The size restrictions by time for remote requests during a
locally placed call. May be NULL. */
struct uuconf_timespan *uuconf_qcall_remote_size;
/* The size restrictions by time for local requests during a
remotely placed call. May be NULL. */
struct uuconf_timespan *uuconf_qcalled_local_size;
/* The size restrictions by time for remote requests during a
remotely placed call. May be NULL. */
struct uuconf_timespan *uuconf_qcalled_remote_size;
/* Baud rate, or speed. Zero means any baud rate. If ihighbaud is
non-zero, this is the low baud rate of a range. */
long uuconf_ibaud;
/* If non-zero, ibaud is the low baud rate of a range and ihighbaud
is the high baud rate. */
long uuconf_ihighbaud;
/* Port name to use. May be NULL. If an HDB configuration file
contains a modem class (alphabetic characters preceeding the baud
rate), the class is appended to the port name. */
char *uuconf_zport;
/* Specific port information, if the system entry includes port
information. May be NULL. */
struct uuconf_port *uuconf_qport;
/* Phone number to call, or address to use for a TCP connection.
May be NULL, in which case a dialer script may not use \D or \T
for this system, and a TCP port will use the system name. */
char *uuconf_zphone;
/* Chat script to use when logging in to the system. */
struct uuconf_chat uuconf_schat;
/* Login name to use for \L in the login chat script. This should
normally be accessed via uuconf_callout. If it is "*",
uuconf_callout will look it up in the call out file. This may be
NULL, in which case the login script may not use \L. */
char *uuconf_zcall_login;
/* Password to use for \P in the login chat script. This should
normally be accessed via uuconf_callout. If it is "*",
uuconf_callout will look it up in the call out file. This may be
NULL, in which case the login script may not use \P. */
char *uuconf_zcall_password;
/* The login name this system must use when calling in. This may be
different for different alternates. This should only be examined
if uuconf_fcalled is TRUE. If this is NULL or "ANY" then
uuconf_validate must be called to make sure that whatever login
name was used is permitted for this machine. */
char *uuconf_zcalled_login;
/* If non-zero, then when this system calls in the call should not
be allowed to proceed and the system should be called back. */
int uuconf_fcallback;
/* If non-zero, then conversation sequence numbers should be used
with this system. */
int uuconf_fsequence;
/* A list of protocols to use with this system. Each protocol has a
single character name. May be NULL, in which case any known
protocol may be used. */
char *uuconf_zprotocols;
/* Array of protocol parameters. Ends in an entry with a
uuconf_bproto field of '\0'. May be NULL. */
struct uuconf_proto_param *uuconf_qproto_params;
/* Chat script to run when called by this system. */
struct uuconf_chat uuconf_scalled_chat;
/* Debugging level to set during a conversation. May be NULL. */
char *uuconf_zdebug;
/* Maximum remote debugging level this system may request. May be
NULL. */
char *uuconf_zmax_remote_debug;
/* Non-zero if the remote system may request us to send files from
the local system to the remote. */
int uuconf_fsend_request;
/* Non-zero if the remote system may request us to receive files
from the remote system to the local. */
int uuconf_frec_request;
/* Non-zero if local requests are permitted when calling this
system. */
int uuconf_fcall_transfer;
/* Non-zero if local requests are permitted when this system calls
in. */
int uuconf_fcalled_transfer;
/* NULL terminated list of directories from which files may be sent
by local request. */
char **uuconf_pzlocal_send;
/* NULL terminated list of directories from which files may be sent
by remote request. */
char **uuconf_pzremote_send;
/* NULL terminated list of directories into which files may be
received by local request. */
char **uuconf_pzlocal_receive;
/* NULL terminated list of directories into which files may be
received by remote request. */
char **uuconf_pzremote_receive;
/* Path to use for command execution. This is a NULL terminated
list of directories. */
char **uuconf_pzpath;
/* NULL terminated List of commands that may be executed. */
char **uuconf_pzcmds;
/* Amount of free space to leave when accepting a file from this
system, in bytes. */
long uuconf_cfree_space;
/* NULL terminated list of systems that this system may forward
from. May be NULL if there are no systems from which files may
be forwarded. The list may include "ANY". */
char **uuconf_pzforward_from;
/* NULL terminated list of systems that this system may forward to.
May be NULL if there are no systems to which files may be
forwarded. The list may include "ANY". */
char **uuconf_pzforward_to;
/* The public directory to use for this sytem. */
const char *uuconf_zpubdir;
/* The local name to use for this remote system. May be NULL if the
usual local name should be used. */
char *uuconf_zlocalname;
/* The maximum number of seconds to spend sending one file when
there are other files to send when using a protocol which permits
interrupting a file send. This is zero if there is no limit. */
long uuconf_cmax_file_time;
/* Memory allocation block for the system. */
UUCONF_POINTER uuconf_palloc;
};
/* Types of ports. */
enum uuconf_porttype
{
/* Unknown port type. A port of this type should never be returned
by the uuconf functions. */
UUCONF_PORTTYPE_UNKNOWN,
/* Read from standard input and write to standard output. Not
normally used. */
UUCONF_PORTTYPE_STDIN,
/* A modem port. */
UUCONF_PORTTYPE_MODEM,
/* A direct connect port. */
UUCONF_PORTTYPE_DIRECT,
/* A TCP port. Not supported on all systems. */
UUCONF_PORTTYPE_TCP,
/* A TLI port. Not supported on all systems. */
UUCONF_PORTTYPE_TLI,
/* A pipe port. Not supported on all systems. */
UUCONF_PORTTYPE_PIPE
};
/* Additional information for a stdin port (there is none). */
struct uuconf_stdin_port
{
int uuconf_idummy;
};
/* Additional information for a modem port. */
struct uuconf_modem_port
{
/* The device name. May be NULL, in which case the port name is
used instead. */
char *uuconf_zdevice;
/* The device name to send the dialer chat script to. May be NULL,
in which case the chat script is sent to the usual device. */
char *uuconf_zdial_device;
/* The default baud rate (speed). If zero, there is no default. */
long uuconf_ibaud;
/* The low baud rate, if a range is used. If zero, a range is not
used and ihighbaud should be ignored. */
long uuconf_ilowbaud;
/* The high baud rate, if ilowbaud is non-zero. */
long uuconf_ihighbaud;
/* Non-zero if the port supports carrier detect. */
int uuconf_fcarrier;
/* Non-zero if the port supports hardware flow control. */
int uuconf_fhardflow;
/* A NULL terminated sequence of dialer/token pairs (element 0 is a
dialer name, element 1 is a token, etc.) May be NULL, in which
case qdialer should not be NULL. */
char **uuconf_pzdialer;
/* Specific dialer information. Only used if pzdialer is NULL. */
struct uuconf_dialer *uuconf_qdialer;
};
/* Additional information for a direct connect port. */
struct uuconf_direct_port
{
/* The device name. May be NULL, in which case the port name is
used instead. */
char *uuconf_zdevice;
/* The baud rate (speed). */
long uuconf_ibaud;
/* Non-zero if the port uses carrier detect. */
int uuconf_fcarrier;
/* Non-zero if the port supports hardware flow control. */
int uuconf_fhardflow;
};
/* Additional information for a TCP port. */
struct uuconf_tcp_port
{
/* The TCP port number to use. May be a name or a number. May be
NULL, in which case "uucp" is looked up using getservbyname. */
char *uuconf_zport;
/* The IP version number to use. This is 0 for any, 4 for IPv4, 6
for IPv6. */
int uuconf_iversion;
/* A NULL terminated sequence of dialer/token pairs (element 0 is a
dialer name, element 1 is a token, etc.) May be NULL. */
char **uuconf_pzdialer;
};
/* Additional information for a TLI port. */
struct uuconf_tli_port
{
/* Device name to open. May be NULL, in which case the port name is
used. */
char *uuconf_zdevice;
/* Whether this port should be turned into a stream, permitting the
read and write calls instead of the t_rcv and t_send calls. */
int uuconf_fstream;
/* A NULL terminated list of modules to push after making the
connection. May be NULL, in which case if fstream is non-zero,
then "tirdwr" is pushed onto the stream, and otherwise nothing is
pushed. */
char **uuconf_pzpush;
/* A NULL terminated sequence of dialer/token pairs (element 0 is a
dialer name, element 1 is a token, etc.) May be NULL. If
element 0 is TLI or TLIS, element 1 is used as the address to
connect to; otherwise uuconf_zphone from the system information
is used. */
char **uuconf_pzdialer;
/* Address to use when operating as a server. This may contain
escape sequences. */
char *uuconf_zservaddr;
};
/* Additional information for a pipe port. */
struct uuconf_pipe_port
{
/* The command and its arguments. */
char **uuconf_pzcmd;
};
/* Information kept for a port. */
struct uuconf_port
{
/* The name of the port. */
char *uuconf_zname;
/* The type of the port. */
enum uuconf_porttype uuconf_ttype;
/* The list of protocols supported by the port. The name of each
protocol is a single character. May be NULL, in which case any
protocol is permitted. */
char *uuconf_zprotocols;
/* Array of protocol parameters. Ends in an entry with a
uuconf_bproto field of '\0'. May be NULL. */
struct uuconf_proto_param *uuconf_qproto_params;
/* The set of reliability bits. */
int uuconf_ireliable;
/* The lock file name to use. */
char *uuconf_zlockname;
/* Memory allocation block for the port. */
UUCONF_POINTER uuconf_palloc;
/* The type specific information. */
union
{
struct uuconf_stdin_port uuconf_sstdin;
struct uuconf_modem_port uuconf_smodem;
struct uuconf_direct_port uuconf_sdirect;
struct uuconf_tcp_port uuconf_stcp;
struct uuconf_tli_port uuconf_stli;
struct uuconf_pipe_port uuconf_spipe;
} uuconf_u;
};
/* Information kept about a dialer. */
struct uuconf_dialer
{
/* The name of the dialer. */
char *uuconf_zname;
/* The chat script to use when dialing out. */
struct uuconf_chat uuconf_schat;
/* The string to send when a `=' appears in the phone number. */
char *uuconf_zdialtone;
/* The string to send when a `-' appears in the phone number. */
char *uuconf_zpause;
/* Non-zero if the dialer supports carrier detect. */
int uuconf_fcarrier;
/* The number of seconds to wait for carrier after the chat script
is complete. Only used if fcarrier is non-zero. Only supported
on some systems. */
int uuconf_ccarrier_wait;
/* If non-zero, DTR should be toggled before dialing. Only
supported on some systems. */
int uuconf_fdtr_toggle;
/* If non-zero, sleep for 1 second after toggling DTR. Ignored if
fdtr_toggle is zero. */
int uuconf_fdtr_toggle_wait;
/* The chat script to use when a call is complete. */
struct uuconf_chat uuconf_scomplete;
/* The chat script to use when a call is aborted. */
struct uuconf_chat uuconf_sabort;
/* Array of protocol parameters. Ends in an entry with a
uuconf_bproto field of '\0'. May be NULL. */
struct uuconf_proto_param *uuconf_qproto_params;
/* The set of reliability bits. */
int uuconf_ireliable;
/* Memory allocation block for the dialer. */
UUCONF_POINTER uuconf_palloc;
};
/* Information returned by uuconf_config_files. Any field in this
struct may be NULL, indicating that the corresponding files will
not be read. */
struct uuconf_config_file_names
{
/* Taylor UUCP config file name. */
UUCONF_CONST char *uuconf_ztaylor_config;
/* Taylor UUCP sys file names; NULL terminated. */
UUCONF_CONST char * UUCONF_CONST *uuconf_pztaylor_sys;
/* Taylor UUCP port file names; NULL terminated. */
UUCONF_CONST char * UUCONF_CONST *uuconf_pztaylor_port;
/* Taylor UUCP dial file names; NULL terminated. */
UUCONF_CONST char * UUCONF_CONST *uuconf_pztaylor_dial;
/* UUCP dialcode file names; NULL terminated. */
UUCONF_CONST char * UUCONF_CONST *uuconf_pzdialcode;
/* Taylor UUCP passwd file names; NULL terminated. */
UUCONF_CONST char * UUCONF_CONST *uuconf_pztaylor_pwd;
/* Taylor UUCP call file names; NULL terminated. */
UUCONF_CONST char * UUCONF_CONST *uuconf_pztaylor_call;
/* V2 system file name. */
UUCONF_CONST char *uuconf_zv2_systems;
/* V2 device file name. */
UUCONF_CONST char *uuconf_zv2_device;
/* V2 user permissions file name. */
UUCONF_CONST char *uuconf_zv2_userfile;
/* V2 user permitted commands file name. */
UUCONF_CONST char *uuconf_zv2_cmds;
/* HDB system file names; NULL terminated. */
UUCONF_CONST char * UUCONF_CONST *uuconf_pzhdb_systems;
/* HDB device file names; NULL terminated. */
UUCONF_CONST char * UUCONF_CONST *uuconf_pzhdb_devices;
/* HDB dialer file names; NULL terminated. */
UUCONF_CONST char * UUCONF_CONST *uuconf_pzhdb_dialers;
/* HDB permissions file name. */
UUCONF_CONST char *uuconf_zhdb_permissions;
};
/* Reliability bits for the ireliable field of ports and dialers.
These bits are used to decide which protocol to run. A given
protocol will have a set of these bits, and each of them must be
turned on for the port before we will permit that protocol to be
used. This will be overridden by the zprotocols field. */
/* Whether a set of reliability bits is given. If this bit is not
set, then there is no reliability information. */
#define UUCONF_RELIABLE_SPECIFIED (01)
/* Set if the connection is eight bit transparent. */
#define UUCONF_RELIABLE_EIGHT (02)
/* Set if the connection is error-free. */
#define UUCONF_RELIABLE_RELIABLE (04)
/* Set if the connection is end-to-end reliable (e.g. TCP). */
#define UUCONF_RELIABLE_ENDTOEND (010)
/* Set if the connection is full-duplex; that is, no time consuming
line turnaround is required before sending data in the reverse
direction. If the connection is truly half-duplex, in the sense
that communication can only flow in one direction, UUCP can not be
used. */
#define UUCONF_RELIABLE_FULLDUPLEX (020)
/* UUCP grades range from 0 to 9, A to Z, a to z in order from highest
to lowest (work of higher grades is done before work of lower
grades). */
/* The highest grade. */
#define UUCONF_GRADE_HIGH ('0')
/* The lowest grade. */
#define UUCONF_GRADE_LOW ('z')
/* Whether a character is a legal grade (requires <ctype.h>). */
#define UUCONF_GRADE_LEGAL(b) (isalnum (BUCHAR (b)))
/* Return < 0 if the first grade should be done before the second
grade, == 0 if they are the same, or > 0 if the first grade should
be done after the second grade. On an ASCII system, this can just
be b1 - b2. */
#define UUCONF_GRADE_CMP(b1, b2) (uuconf_grade_cmp ((b1), (b2)))
/* Definitions for bits returned by uuconf_strip. */
#define UUCONF_STRIP_LOGIN (01)
#define UUCONF_STRIP_PROTO (02)
/* uuconf_runuuxqt returns either a positive number (the number of
execution files to receive between uuxqt invocations) or one of
these constant values. */
#define UUCONF_RUNUUXQT_NEVER (0)
#define UUCONF_RUNUUXQT_ONCE (-1)
#define UUCONF_RUNUUXQT_PERCALL (-2)
/* Most of the uuconf functions returns an error code. A value of
zero (UUCONF_SUCCESS) indicates success. */
/* If this bit is set in the returned error code, then the
uuconf_errno function may be used to obtain the errno value as set
by the function which caused the failure. */
#define UUCONF_ERROR_ERRNO (0x100)
/* If this bit is set in the returned error code, then the
uuconf_filename function may be used to get the name of a file
associated with the error. */
#define UUCONF_ERROR_FILENAME (0x200)
/* If this bit is set in the returned error code, then the
uuconf_lineno function may be used to get a line number associated
with the error; normally if this is set UUCONF_ERROR_FILENAME will
also be set. */
#define UUCONF_ERROR_LINENO (0x400)
/* There are two UUCONF_CMDTABRET bits that may be set in the return
value of uuconf_cmd_line or uuconf_cmd_args, described below. They
do not indicate an error, but instead give instructions to the
calling function, often uuconf_cmd_file. They may also be set in
the return value of a user function listed in a uuconf_cmdtab
table, in which case they will be honored by uuconf_cmd_file. */
/* This bit means that the memory occupied by the arguments passed to
the function should be preserved, and not overwritten or freed. It
refers only to the contents of the arguments; the contents of the
argv array itself may always be destroyed. If this bit is set in
the return value of uuconf_cmd_line or uuconf_cmd_args, it must be
honored. It will be honored by uuconf_cmd_file. This may be
combined with an error code or with UUCONF_CMDTABRET_EXIT, although
neither uuconf_cmd_file or uuconf_cmd_line will do so. */
#define UUCONF_CMDTABRET_KEEP (0x800)
/* This bit means that uuconf_cmd_file should exit, rather than go on
to read and process the next line. If uuconf_cmd_line or
uuconf_cmd_args encounter an error, the return value will have this
bit set along with the error code. A user function may set this
bit with or without an error; the return value of the user function
will be returned by uuconf_cmd_file, except that the
UUCONF_CMDTABRET_KEEP and UUCONF_CMDTABRET_EXIT bits will be
cleared. */
#define UUCONF_CMDTABRET_EXIT (0x1000)
/* This macro may be used to extract the specific error value. */
#define UUCONF_ERROR_VALUE(i) ((i) & 0xff)
/* UUCONF_ERROR_VALUE will return one of the following values. */
/* Function succeeded. */
#define UUCONF_SUCCESS (0)
/* Named item not found. */
#define UUCONF_NOT_FOUND (1)
/* A call to fopen failed. */
#define UUCONF_FOPEN_FAILED (2)
/* A call to fseek failed. */
#define UUCONF_FSEEK_FAILED (3)
/* A call to malloc or realloc failed. */
#define UUCONF_MALLOC_FAILED (4)
/* Syntax error in file. */
#define UUCONF_SYNTAX_ERROR (5)
/* Unknown command. */
#define UUCONF_UNKNOWN_COMMAND (6)
#if UUCONF_ANSI_C
/* For each type of configuration file (Taylor, V2, HDB), there are
separate routines to read various sorts of information. There are
also generic routines, which call on the appropriate type specific
routines. The library can be compiled to read any desired
combination of the configuration file types. This affects only the
generic routines, as it determines which type specific routines
they call. Thus, on a system which, for example, does not have any
V2 configuration files, there is no need to include the overhead of
the code to parse the files and the time to look for them.
However, a program which specifically wants to be able to parse
them can call the V2 specific routines.
The uuconf functions all take as an argument a pointer to uuconf
global information. This must be initialized by any the
initialization routines (the generic one and the three file type
specific ones) before any of the other uuconf functions may be
called. */
/* Initialize the configuration file reading routines. The ppglobal
argument should point to a generic pointer (a void *, or, on older
compilers, a char *) which will be initialized and may then be
passed to the other uuconf routines. The zprogram argument is the
name of the program for which files should be read. A NULL is
taken as "uucp", and reads the standard UUCP configuration files.
The only other common argument is "cu", but any string is
permitted. The zname argument is the name of the Taylor UUCP
config file; if it is NULL, the default config file will be read.
If not reading Taylor UUCP configuration information, the argument
is ignored. This function must be called before any of the other
uuconf functions.
Note that if the zname argument is obtained from the user running
the program, the program should be careful to revoke any special
privileges it may have (e.g. on Unix call setuid (getuid ()) and
setgid (getgid ())). Otherwise various sorts of spoofing become
possible. */
extern int uuconf_init (void **uuconf_ppglobal,
const char *uuconf_zprogram,
const char *uuconf_zname);
/* Adjust the configuration file global pointer for a new thread. The
library is fully reentrant (with the exception of the function
uuconf_error_string, which calls strerror, which on some systems is
not reentrant), provided that each new thread that wishes to call
the library calls this function and uses the new global pointer
value. The ppglobal argument should be set to the address of the
global pointer set by any of the init functions; it will be
modified to become a new global pointer. */
extern int uuconf_init_thread (void **uuconf_ppglobal);
/* Get the names of all known systems. This sets sets *ppzsystems to
point to an array of system names. The list of names is NULL
terminated. The array is allocated using malloc, as is each
element of the array, and they may all be passed to free when they
are no longer needed. If the falias argument is 0, the list will
not include any aliases; otherwise, it will. */
extern int uuconf_system_names (void *uuconf_pglobal,
char ***uuconf_ppzsystems,
int uuconf_falias);
/* Get the information for the system zsystem. This sets the fields
in *qsys. This will work whether zsystem is the official name of
the system or merely an alias. */
extern int uuconf_system_info (void *uuconf_pglobal,
const char *uuconf_zsystem,
struct uuconf_system *uuconf_qsys);
/* Get information for an unknown (anonymous) system. The
uuconf_zname field of the returned system information will be NULL.
If no information is available for unknown systems, this will
return UUCONF_NOT_FOUND. This does not run the HDB remote.unknown
shell script. */
extern int uuconf_system_unknown (void *uuconf_pglobal,
struct uuconf_system *uuconf_qsys);
/* Get information for the local system. Normally the local system
name should first be looked up using uuconf_system_info. If that
returns UUCONF_NOT_FOUND, this function may be used to get an
appropriate set of defaults. The uuconf_zname field of the
returned system information may be NULL. */
extern int uuconf_system_local (void *uuconf_pglobal,
struct uuconf_system *uuconf_qsys);
/* Free the memory occupied by system information returned by
uuconf_system_info, uuconf_system_unknown, uuconf_system_local, or
any of the configuration file type specific routines described
below. After this is called, the contents of the structure shall
not be referred to. */
extern int uuconf_system_free (void *uuconf_pglobal,
struct uuconf_system *uuconf_qsys);
#ifdef __OPTIMIZE__
#define uuconf_system_free(qglob, q) \
(uuconf_free_block ((q)->uuconf_palloc), UUCONF_SUCCESS)
#endif
/* Find a matching port. This will consider each port in turn.
If the zname argument is not NULL, the port's uuconf_zname field
must match it.
If the ibaud argument is not zero and the ihighbaud argument is
zero, the port's baud rate, if defined, must be the same (if the
port has a range of baud rates, ibaud must be within the range).
If ibaud and ihighbaud are both not zero, the port's baud rate, if
defined, must be between ibaud and ihighbaud inclusive (if the port
has a range of baud rates, the ranges must intersect). If the port
has no baud rate, either because it is a type of port for which
baud rate is not defined (e.g. a TCP port) or because the
uuconf_ibaud field is 0, the ibaud and ihighbaud arguments are
ignored.
If the pifn argument is not NULL, the port is passed to pifn, along
with the pinfo argument (which is otherwise ignored). If pifn
returns UUCONF_SUCCESS, the port matches. If pifn returns
UUCONF_NOT_FOUND, a new port is sought. Otherwise the return value
of pifn is returned from uuconf_find_port. The pifn function may
be used to further restrict the port, such as by modem class or
device name. It may also be used to lock the port, if appropriate;
in this case, if the lock fails, pifn may return UUCONF_NOT_FOUND
to force uuconf_find_port to continue searching for a port.
If the port matches, the information is set into uuconf_qport, and
uuconf_find_port returns UUCONF_SUCCESS. */
extern int uuconf_find_port (void *uuconf_pglobal,
const char *uuconf_zname,
long uuconf_ibaud,
long uuconf_ihighbaud,
int (*uuconf_pifn) (struct uuconf_port *,
void *uuconf_pinfo),
void *uuconf_pinfo,
struct uuconf_port *uuconf_qport);
/* Free the memory occupied by system information returned by
uuconf_find_port (or any of the configuration file specific
routines described below). After this is called, the contents of
the structure shall not be referred to. */
extern int uuconf_port_free (void *uuconf_pglobal,
struct uuconf_port *uuconf_qport);
#ifdef __OPTIMIZE__
#define uuconf_port_free(qglob, q) \
(uuconf_free_block ((q)->uuconf_palloc), UUCONF_SUCCESS)
#endif
/* Get the names of all known dialers. This sets sets *ppzdialers to
point to an array of dialer names. The list of names is NULL
terminated. The array is allocated using malloc, as is each
element of the array, and they may all be passed to free when they
are no longer needed. */
extern int uuconf_dialer_names (void *uuconf_pglobal,
char ***uuconf_ppzdialers);
/* Get the information for the dialer zdialer. This sets the fields
in *qdialer. */
extern int uuconf_dialer_info (void *uuconf_pglobal,
const char *uuconf_zdialer,
struct uuconf_dialer *uuconf_qdialer);
/* Free the memory occupied by system information returned by
uuconf_dialer_info (or any of the configuration file specific
routines described below). After this is called, the contents of
the structure shall not be referred to. */
extern int uuconf_dialer_free (void *uuconf_pglobal,
struct uuconf_dialer *uuconf_qsys);
#ifdef __OPTIMIZE__
#define uuconf_dialer_free(qglob, q) \
(uuconf_free_block ((q)->uuconf_palloc), UUCONF_SUCCESS)
#endif
/* Get the configuration file names. The fields in the returned
struct should not be freed. */
extern int uuconf_config_files (void *uuconf_pglobal,
struct uuconf_config_file_names* uuconf_names);
/* Get the local node name. If the node name is not specified
(because no ``nodename'' command appeared in the config file) this
will return UUCONF_NOT_FOUND, and some system dependent function
must be used to determine the node name. Otherwise it will return
a pointer to a constant string, which should not be freed. */
extern int uuconf_localname (void *uuconf_pglobal,
const char **pzname);
/* Get the local node name that should be used, given a login name.
This function will check for any special local name that may be
associated with the login name zlogin (as set by the ``myname''
command in a Taylor configuration file, or the MYNAME field in a
Permissions entry). This will set *pzname to the node name. If no
node name can be determined, *pzname will be set to NULL and the
function will return UUCONF_NOT_FOUND; in this case some system
dependent function must be used to determine the node name. If the
function returns UUCONF_SUCCESS, *pzname will be point to an
malloced buffer. */
extern int uuconf_login_localname (void *uuconf_pglobal,
const char *uuconf_zlogin,
char **pzname);
/* Get the name of the UUCP spool directory. This will set *pzspool
to a constant string, which should not be freed. */
extern int uuconf_spooldir (void *uuconf_pglobal,
const char **uuconf_pzspool);
/* Get the name of the default UUCP public directory. This will set
*pzpub to a constant string, which should not be freed. Note that
particular systems may use a different public directory. */
extern int uuconf_pubdir (void *uuconf_pglobal,
const char **uuconf_pzpub);
/* Get the name of the UUCP lock directory. This will set *pzlock to
a constant string, which should not be freed. */
extern int uuconf_lockdir (void *uuconf_pglobal,
const char **uuconf_pzlock);
/* Get the name of the UUCP log file. This will set *pzlog to a
constant string, which should not be freed. */
extern int uuconf_logfile (void *uuconf_pglobal,
const char **uuconf_pzlog);
/* Get the name of the UUCP statistics file. This will set *pzstats
to a constant string, which should not be freed. */
extern int uuconf_statsfile (void *uuconf_pglobal,
const char **uuconf_pzstats);
/* Get the name of the UUCP debugging file. This will set *pzdebug to
a constant string, which should not be freed. */
extern int uuconf_debugfile (void *uuconf_pglobal,
const char **uuconf_pzdebug);
/* Get the default debugging level to use. This basically gets the
argument of the ``debug'' command from the Taylor UUCP config file.
It will set *pzdebug to a constant string, which should not be
freed. */
extern int uuconf_debuglevel (void *uuconf_pglobal,
const char **uuconf_pzdebug);
/* Get a combination of UUCONF_STRIP bits indicating what types of
global information should be stripped on input. */
extern int uuconf_strip (void *uuconf_pglobal,
int *uuconf_pistrip);
/* Get the maximum number of simultaneous uuxqt executions. This will
set *pcmaxuuxqt to the number. Zero indicates no maximum. */
extern int uuconf_maxuuxqts (void *uuconf_pglobal,
int *uuconf_pcmaxuuxqt);
/* Get the frequency with which to spawn a uuxqt process. This
returns an integer. A positive number is the number of execution
files that should be received between spawns. Other values are one
of the UUCONF_RUNUUXQT constants listed above. */
extern int uuconf_runuuxqt (void *uuconf_pglobal,
int *uuconf_pirunuuxqt);
/* Check a login name and password. This checks the Taylor UUCP
password file (not /etc/passwd). It will work even if
uuconf_taylor_init was not called. All comparisons are done via a
callback function. The first argument to the function will be zero
when comparing login names, non-zero when comparing passwords. The
second argument to the function will be the pinfo argument passed
to uuconf_callin. The third argument will be the login name or
password from the UUCP password file. The comparison function
should return non-zero for a match, or zero for a non-match. If
the login name is found and the password compares correctly,
uuconf_callin will return UUCONF_SUCCESS. If the login is not
found, or the password does not compare correctly, uuconf_callin
will return UUCONF_NOT_FOUND. Other errors are also possible. */
extern int uuconf_callin (void *uuconf_pglobal,
int (*uuconf_cmp) (int, void *, const char *),
void *uuconf_pinfo);
/* Get the callout login name and password for a system. This will
set both *pzlog and *pzpass to a string allocated by malloc, or to
NULL if the value is not found. If neither value is found, the
function will return UUCONF_NOT_FOUND. */
extern int uuconf_callout (void *uuconf_pglobal,
const struct uuconf_system *uuconf_qsys,
char **uuconf_pzlog,
char **uuconf_pzpass);
/* See if a login name is permitted for a system. This will return
UUCONF_SUCCESS if it is permitted or UUCONF_NOT_FOUND if it is
invalid. This simply calls uuconf_taylor_validate or returns
UUCONF_SUCCESS, depending on the value of HAVE_TAYLOR_CONFIG. */
extern int uuconf_validate (void *uuconf_pglobal,
const struct uuconf_system *uuconf_qsys,
const char *uuconf_zlogin);
/* Get the name of the HDB remote.unknown shell script, if using
HAVE_HDB_CONFIG. This does not actually run the shell script. If
the function returns UUCONF_SUCCESS, the name will be in *pzname,
which will point to an malloced buffer. If it returns
UUCONF_NOT_FOUND, then there is no script to run. */
extern int uuconf_remote_unknown (void *uuconf_pglobal,
char **pzname);
/* Translate a dial code. This sets *pznum to an malloced string.
This will look up the entire zdial string in the dialcode file, so
for normal use the alphabetic prefix should be separated. */
extern int uuconf_dialcode (void *uuconf_pglobal,
const char *uuconf_zdial,
char **uuconf_pznum);
/* Compare two grades, returning < 0 if b1 should be executed before
b2, == 0 if they are the same, or > 0 if b1 should be executed