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 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607
|
/* 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 ian@airs.com.
*/
#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
after b2. This can not fail, and does not return a standard uuconf
error code; it is normally called via the macro UUCONF_GRADE_CMP,
defined above. */
extern int uuconf_grade_cmp (int uuconf_b1, int uuconf_b2);
#else /* ! UUCONF_ANSI_C */
extern int uuconf_init ();
extern int uuconf_init_thread ();
extern int uuconf_system_names ();
extern int uuconf_system_info ();
extern int uuconf_system_unknown ();
extern int uuconf_system_local ();
extern int uuconf_system_free ();
extern int uuconf_find_port ();
extern int uuconf_port_free ();
extern int uuconf_dialer_names ();
extern int uuconf_dialer_info ();
extern int uuconf_dialer_free ();
extern int uuconf_config_files ();
extern int uuconf_localname ();
extern int uuconf_login_localname ();
extern int uuconf_spooldir ();
extern int uuconf_lockdir ();
extern int uuconf_pubdir ();
extern int uuconf_logfile ();
extern int uuconf_statsfile ();
extern int uuconf_debugfile ();
extern int uuconf_debuglevel ();
extern int uuconf_maxuuxqts ();
extern int uuconf_runuuxqt ();
extern int uuconf_callin ();
extern int uuconf_callout ();
extern int uuconf_remote_unknown ();
extern int uuconf_validate ();
extern int uuconf_grade_cmp ();
#ifdef __OPTIMIZE__
#define uuconf_system_free(qglob, q) \
(uuconf_free_block ((q)->uuconf_palloc), UUCONF_SUCCESS)
#define uuconf_port_free(qglob, q) \
(uuconf_free_block ((q)->uuconf_palloc), UUCONF_SUCCESS)
#define uuconf_dialer_free(qglob, q) \
(uuconf_free_block ((q)->uuconf_palloc), UUCONF_SUCCESS)
#endif
#endif /* ! UUCONF_ANSI_C */
#if UUCONF_ANSI_C
/* Initialize the Taylor UUCP configuration file reading routines.
This must be called before calling any of the Taylor UUCP
configuration file specific routines. The ppglobal argument should
point to a generic pointer. Moreover, before calling this function
the pointer either must be set to NULL, or must have been passed to
one of the other uuconf init routines. The zprogram argument is
the name of the program for which files should be read. If NULL,
it is taken as "uucp", which means to read the standard UUCP files.
The zname argument is the name of the config file. If it is NULL,
the default config file will be used.
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_taylor_init (void **uuconf_pglobal,
const char *uuconf_zprogram,
const char *uuconf_zname);
/* Get the names of all systems listed in the Taylor UUCP
configuration files. This 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. If the
falias argument is 0, the list will not include any aliases;
otherwise, it will. */
extern int uuconf_taylor_system_names (void *uuconf_pglobal,
char ***uuconf_ppzsystems,
int uuconf_falias);
/* Get the information for system zsystem from the Taylor UUCP
configuration files. This will set *qsys. */
extern int uuconf_taylor_system_info (void *uuconf_pglobal,
const char *uuconf_zsystem,
struct uuconf_system *uuconf_qsys);
/* Get information for an unknown (anonymous) system. This returns
the values set by the ``unknown'' command in the main configuration
file. If the ``unknown'' command was not used, this will return
UUCONF_NOT_FOUND. */
extern int uuconf_taylor_system_unknown (void *uuconf_pglobal,
struct uuconf_system *uuconf_qsys);
/* Find a port from the Taylor UUCP configuration files. The
arguments and return values are identical to those of
uuconf_find_port. */
extern int uuconf_taylor_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);
/* Get the names of all dialers listed in the Taylor UUCP
configuration files. This 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. */
extern int uuconf_taylor_dialer_names (void *uuconf_pglobal,
char ***uuconf_ppzdialers);
/* Get the information for the dialer zdialer from the Taylor UUCP
configuration files. This sets the fields in *qdialer. */
extern int uuconf_taylor_dialer_info (void *uuconf_pglobal,
const char *uuconf_zdialer,
struct uuconf_dialer *uuconf_qdialer);
/* Get the local node name that should be used, given a login name,
considering only the ``myname'' command in the Taylor UUCP
configuration files. If the function returns UUCONF_SUCCESS,
*pzname will point to an malloced buffer. */
extern int uuconf_taylor_login_localname (void *uuconf_pglobal,
const char *uuconf_zlogin,
char **pzname);
/* Get the callout login name and password for a system from the
Taylor UUCP configuration files. 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_taylor_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 checks whether the login name appears in a
called-login command with a list of system which does not include
the system qsys. */
extern int uuconf_taylor_validate (void *uuconf_pglobal,
const struct uuconf_system *uuconf_qsys,
const char *uuconf_zlogin);
#else /* ! UUCONF_ANSI_C */
extern int uuconf_taylor_init ();
extern int uuconf_taylor_system_names ();
extern int uuconf_taylor_system_info ();
extern int uuconf_taylor_system_unknown ();
extern int uuconf_taylor_find_port ();
extern int uuconf_taylor_dialer_names ();
extern int uuconf_taylor_dialer_info ();
extern int uuconf_taylor_login_localname ();
extern int uuconf_taylor_callout ();
extern int uuconf_taylor_validate ();
#endif /* ! UUCONF_ANSI_C */
#if UUCONF_ANSI_C
/* Initialize the V2 configuration file reading routines. This must
be called before any of the other V2 routines are called. The
ppglobal argument should point to a generic pointer. Moreover,
before calling this function the pointer either must be set to
NULL, or must have been passed to one of the other uuconf init
routines. */
extern int uuconf_v2_init (void **uuconf_ppglobal);
/* Get the names of all systems listed in the V2 configuration files.
This 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. If the falias argument is
0, the list will not include any aliases; otherwise, it will. */
extern int uuconf_v2_system_names (void *uuconf_pglobal,
char ***uuconf_ppzsystems,
int uuconf_falias);
/* Get the information for system zsystem from the V2 configuration
files. This will set *qsys. */
extern int uuconf_v2_system_info (void *uuconf_pglobal,
const char *uuconf_zsystem,
struct uuconf_system *uuconf_qsys);
/* Find a port from the V2 configuration files. The arguments and
return values are identical to those of uuconf_find_port. */
extern int uuconf_v2_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);
#else /* ! UUCONF_ANSI_C */
extern int uuconf_v2_init ();
extern int uuconf_v2_system_names ();
extern int uuconf_v2_system_info ();
extern int uuconf_v2_find_port ();
#endif /* ! UUCONF_ANSI_C */
#if UUCONF_ANSI_C
/* Initialize the HDB configuration file reading routines. This
should be called before any of the other HDB routines are called.
The ppglobal argument should point to a generic pointer. Moreover,
before calling this function the pointer either must be set to
NULL, or must have been passed to one of the other uuconf init
routines. The zprogram argument is used to match against a
"services" string in Sysfiles. A NULL or "uucp" argument is taken
as "uucico". */
extern int uuconf_hdb_init (void **uuconf_ppglobal,
const char *uuconf_zprogram);
/* Get the names of all systems listed in the HDB configuration files.
This 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. If the falias argument is
0, the list will not include any aliases; otherwise, it will (an
alias is created by using the ALIAS= keyword in the Permissions
file). */
extern int uuconf_hdb_system_names (void *uuconf_pglobal,
char ***uuconf_ppzsystems,
int uuconf_falias);
/* Get the information for system zsystem from the HDB configuration
files. This will set *qsys. */
extern int uuconf_hdb_system_info (void *uuconf_pglobal,
const char *uuconf_zsystem,
struct uuconf_system *uuconf_qsys);
/* Get information for an unknown (anonymous) system. If no
information is available for unknown systems, this will return
UUCONF_NOT_FOUND. This does not run the remote.unknown shell
script. */
extern int uuconf_hdb_system_unknown (void *uuconf_pglobal,
struct uuconf_system *uuconf_qsys);
/* Find a port from the HDB configuration files. The arguments and
return values are identical to those of uuconf_find_port. */
extern int uuconf_hdb_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);
/* Get the names of all dialers listed in the HDB configuration files.
This 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. */
extern int uuconf_hdb_dialer_names (void *uuconf_pglobal,
char ***uuconf_ppzdialers);
/* Get the information for the dialer zdialer from the HDB
configuration files. This sets the fields in *qdialer. */
extern int uuconf_hdb_dialer_info (void *uuconf_pglobal,
const char *uuconf_zdialer,
struct uuconf_dialer *uuconf_qdialer);
/* Get the local node name that should be used, given a login name,
considering only the MYNAME field in the HDB Permissions file. If
the function returns UUCONF_SUCCESS, *pzname will point to an
malloced buffer. */
extern int uuconf_hdb_login_localname (void *uuconf_pglobal,
const char *uuconf_zlogin,
char **pzname);
/* Get the name of the HDB remote.unknown shell script. 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. */
extern int uuconf_hdb_remote_unknown (void *uuconf_pglobal,
char **pzname);
#else /* ! UUCONF_ANSI_C */
extern int uuconf_hdb_init ();
extern int uuconf_hdb_system_names ();
extern int uuconf_hdb_system_info ();
extern int uuconf_hdb_system_unknown ();
extern int uuconf_hdb_find_port ();
extern int uuconf_hdb_dialer_names ();
extern int uuconf_hdb_dialer_info ();
extern int uuconf_hdb_localname ();
extern int uuconf_hdb_remote_unknown ();
#endif /* ! UUCONF_ANSI_C */
#if UUCONF_ANSI_C
/* This function will set an appropriate error message into the buffer
zbuf, given a uuconf error code. The buffer will always be null
terminated, and will never be accessed beyond the length cbuf.
This function will return the number of characters needed for the
complete message, including the null byte. If this is less than
the cbytes argument, the buffer holds a truncated string. */
extern int uuconf_error_string (void *uuconf_pglobal, int ierror,
char *zbuf, UUCONF_SIZE_T cbuf);
/* If UUCONF_ERROR_ERRNO is set in a return value, this function may
be used to retrieve the errno value. This will be the value of
errno as set by the system function which failed. However, some
system functions, notably some stdio routines, may not set errno,
in which case the value will be meaningless. This function does
not return a uuconf error code, and it cannot fail. */
extern int uuconf_error_errno (void *uuconf_pglobal);
/* If UUCONF_ERROR_FILENAME is set in a return value, this function
may be used to retrieve the file name. This function does not
return a uuconf error code, and it cannot fail. The string that it
returns a pointer to is not guaranteed to remain allocated across
the next call to a uuconf function (other than one of the three
error retrieving functions). */
extern const char *uuconf_error_filename (void *uuconf_pglobal);
/* If UUCONF_ERROR_LINENO is set in a return value, this function may
be used to retrieve the line number. This function does not return
a uuconf error code, and it cannot fail. */
extern int uuconf_error_lineno (void *uuconf_pglobal);
#else /* ! UUCONF_ANSI_C */
extern int uuconf_error_string ();
extern int uuconf_error_errno ();
extern UUCONF_CONST char *uuconf_error_filename ();
extern int uuconf_error_lineno ();
#endif /* ! UUCONF_ANSI_C */
/* The uuconf package also provides a few functions which can accept
commands and parcel them out according to a table. These are
publically visible, partially in the hopes that they will be
useful, but mostly because the rest of the Taylor UUCP package uses
them. */
/* The types of entries allowed in a command table (struct
uuconf_cmdtab). Each type defines how a particular command is
interpreted. Each type will either assign a value to a variable or
call a function. In all cases, a line of input is parsed into
separate fields, separated by whitespace; comments beginning with
'#' are discarded, except that a '#' preceeded by a backslash is
retained. The first field is taken as the command to execute, and
the remaining fields are its arguments. */
/* A boolean value. Used for a command which accepts a single
argument, which must begin with 'y', 'Y', 't', or 'T' for true (1)
or 'n', 'N', 'f', or 'F' for false (0). The corresponding variable
must be an int. */
#define UUCONF_CMDTABTYPE_BOOLEAN (0x12)
/* An integer value. Used for a command which accepts a single
argument, which must be an integer. The corresponding variable
must be an int. */
#define UUCONF_CMDTABTYPE_INT (0x22)
/* A long value. Used for a command which accepts a single value,
which must be an integer. The corresponding variable must be a
long. */
#define UUCONF_CMDTABTYPE_LONG (0x32)
/* A string value. Used for a command which accepts a string
argument. If there is no argument, the variable will be set to
point to a zero byte. Otherwise the variable will be set to point
to the string. The corresponding variable must be a char *. The
memory pointed to by the variable after it is set must not be
modified. */
#define UUCONF_CMDTABTYPE_STRING (0x40)
/* A full string value. Used for a command which accepts a series of
string arguments separated by whitespace. The corresponding
variable must be a char **. It will be set to an NULL terminated
array of the arguments. The memory occupied by the array itself,
and by the strings within it, must not be modified. */
#define UUCONF_CMDTABTYPE_FULLSTRING (0x50)
/* A function. If this command is encountered, the command and its
arguments are passed to the corresponding function. They are
passed as an array of strings, in which the first string is the
command itself, along with a count of strings. This value may be
or'red with a specific number of required arguments;
UUCONF_CMDTABTYPE_FN | 1 accepts no additional arguments besides
the command itself, UUCONF_CMDTABTYPE_FN | 2 accepts 1 argument,
etc. UUCONF_CMDTABTYPE_FN | 0, accepts any number of additional
arguments. */
#define UUCONF_CMDTABTYPE_FN (0x60)
/* A prefix function. The string in the table is a prefix; if a
command is encountered with the same prefix, the corresponding
function will be called as for UUCONF_CMDTABTYPE_FN. The number of
arguments may be or'red in as with UUCONF_CMDTABTYPE_FN. */
#define UUCONF_CMDTABTYPE_PREFIX (0x70)
/* This macro will return the particular type of a CMDTABTYPE. */
#define UUCONF_TTYPE_CMDTABTYPE(i) ((i) & 0x70)
/* This macro will return the required number of arguments of a
CMDTABTYPE. If it is zero, there is no restriction. */
#define UUCONF_CARGS_CMDTABTYPE(i) ((i) & 0x0f)
/* When a function is called via UUCONF_CMDTABTYPE_FN or
UUCONF_CMDTABTYPE_PREFIX, it may return any uuconf error code (see
above). However, it will normally return one of the following:
UUCONF_CMDTABRET_CONTINUE: Take no special action. In particular,
the arguments passed to the function may be overwritten or freed.
UUCONF_CMDTABRET_KEEP: The memory occupied by the arguments passed
to the function must be preserved. Continue processing commands.
UUCONF_CMDTABRET_EXIT: If reading commands from a file, stop
processing. The arguments passed to the function may be
overwritten or freed.
UUCONF_CMDTABRET_KEEP_AND_EXIT: Stop processing any file. The
memory occupied by the arguments passed to the function must be
preserved.
These values are interpreted by uuconf_cmd_file. The
uuconf_cmd_line and uuconf_cmd_args functions may return
UUCONF_CMDTABRET_KEEP. It they get an error, they will return an
error code with UUCONF_CMDTABRET_EXIT set. Also, of course, they
may return any value that is returned by one of the user functions
in the uuconf_cmdtab table. */
/* UUCONF_CMDTABRET_KEEP and UUCONF_CMDTABRET_EXIT are defined above,
with the error codes. */
#define UUCONF_CMDTABRET_CONTINUE UUCONF_SUCCESS
#define UUCONF_CMDTABRET_KEEP_AND_EXIT \
(UUCONF_CMDTABRET_KEEP | UUCONF_CMDTABRET_EXIT)
/* When a function is called via CMDTABTYPE_FN or CMDTABTYPE_PREFIX,
it is passed five arguments. This is the type of a pointer to such
a function. The uuconf global information structure is passed in
for convenience in calling another uuconf function. The arguments
to the command are passed in (the command itself is the first
argument) along with a count and the value of the pvar field from
the uuconf_cmdtab structure in which the function pointer was
found. The pinfo argument to the function is taken from the
argument to uuconf_cmd_*. */
#if UUCONF_ANSI_C
typedef int (*uuconf_cmdtabfn) (void *uuconf_pglobal,
int uuconf_argc,
char **uuconf_argv,
void *uuconf_pvar,
void *uuconf_pinfo);
#else
typedef int (*uuconf_cmdtabfn) ();
#endif
/* A table of commands is an array of the following structures. The
final element of the table should have uuconf_zcmd == NULL. */
struct uuconf_cmdtab
{
/* Command name. */
UUCONF_CONST char *uuconf_zcmd;
/* Command type (one of CMDTABTYPE_*). */
int uuconf_itype;
/* If not CMDTABTYPE_FN or CMDTABTYPE_PREFIX, the address of the
associated variable. Otherwise, a pointer value to pass to the
function pifn. */
UUCONF_POINTER uuconf_pvar;
/* The function to call if CMDTABTYPE_FN or CMDTABTYPE_PREFIX. */
uuconf_cmdtabfn uuconf_pifn;
};
/* Bit flags to pass to uuconf_processcmds. */
/* If set, case is significant when checking commands. Normally case
is ignored. */
#define UUCONF_CMDTABFLAG_CASE (0x1)
/* If set, a backslash at the end of a line may be used to include the
next physical line in the logical line. */
#define UUCONF_CMDTABFLAG_BACKSLASH (0x2)
/* If set, the comment character (#) is treated as a normal character,
rather than as starting a comment. */
#define UUCONF_CMDTABFLAG_NOCOMMENTS (0x4)
#if UUCONF_ANSI_C
/* Read commands from a file, look them up in a table, and take the
appropriate action. This continues reading lines from the file
until EOF, or until a function returns with UUCONF_CMDTABRET_EXIT
set, or until an error occurs. The qtab argument must point to a
table of struct uuconf_cmdtab; the last element in the table should
have uuconf_zcmd == NULL. When a UUCONF_CMDTABTYPE_FN or
UUCONF_CMDTABTYPE_PREFIX command is found, the pinfo argument will
be passed to the called function. If an a command is found that is
not in the table, then if pfiunknownfn is NULL the unknown command
is ignored; otherwise it is passed to pfiunknownfn, which should
return a uuconf return code which is handled as for any other
function (the pvar argument to pfiunknownfn will always be NULL).
The iflags argument is any combination of the above
UUCONF_CMDTABFLAG bits. The pblock argument may also be a memory
block, as returned by uuconf_malloc_block (described below), in
which case all memory preserved because of UUCONF_CMDTABRET_KEEP
will be added to the block so that it may be freed later; it may
also be NULL, in which case any such memory is permanently lost.
This function initially sets the internal line number to 0, and
then increments it as each line is read. It is permitted for any
called function to use the uuconf_lineno function to obtain it. If
this function is called when not at the start of a file, the value
returned by uuconf_lineno (which is, in any case, only valid if an
error code with UUCONF_ERROR_LINENO set is returned) must be
adjusted by the caller.
This returns a normal uuconf return value, as described above. */
extern int uuconf_cmd_file (void *uuconf_pglobal,
FILE *uuconf_e,
const struct uuconf_cmdtab *uuconf_qtab,
void *uuconf_pinfo,
uuconf_cmdtabfn uuconf_pfiunknownfn,
int uuconf_iflags,
void *pblock);
/* This utility function is just like uuconf_cmd_file, except that it
only operates on a single string. If a function is called via
qtab, its return value will be the return value of this function.
UUCONF_CMDTABFLAG_BACKSLASH is ignored in iflags. The string z is
modified in place. The return value may include the
UUCONF_CMDTABRET_KEEP and, on error, the UUCONF_CMDTABRET_EXIT
bits, which should be honored by the calling code. */
extern int uuconf_cmd_line (void *uuconf_pglobal,
char *uuconf_z,
const struct uuconf_cmdtab *uuconf_qtab,
void *uuconf_pinfo,
uuconf_cmdtabfn uuconf_pfiunknownfn,
int uuconf_iflags,
void *pblock);
/* This utility function is just like uuconf_cmd_line, except it is
given a list of already parsed arguments. */
extern int uuconf_cmd_args (void *uuconf_pglobal,
int uuconf_cargs,
char **uuconf_pzargs,
const struct uuconf_cmdtab *uuconf_qtab,
void *uuconf_pinfo,
uuconf_cmdtabfn uuconf_pfiunknownfn,
int uuconf_iflags,
void *pblock);
#else /* ! UUCONF_ANSI_C */
extern int uuconf_cmd_file ();
extern int uuconf_cmd_line ();
extern int uuconf_cmd_args ();
#endif /* ! UUCONF_ANSI_C */
#if UUCONF_ANSI_C
/* The uuconf_cmd_file function may allocate memory permanently, as
for setting a UUCONF_CMDTABTYPE_STRING value, in ways which are
difficult to free up. A memory block may be used to record all
allocated memory, so that it can all be freed up at once at some
later time. These functions do not take a uuconf global pointer,
and are independent of the rest of the uuconf library. */
/* Allocate a block of memory. If this returns NULL, then malloc
returned NULL, and errno is whatever malloc set it to. */
extern void *uuconf_malloc_block (void);
/* Allocate memory within a memory block. If this returns NULL, then
malloc returned NULL, and errno is whatever malloc set it to. */
extern void *uuconf_malloc (void *uuconf_pblock,
UUCONF_SIZE_T uuconf_cbytes);
/* Add a block returned by the generic malloc routine to a memory
block. This returns zero on success, non-zero on failure. If this
fails (returns non-zero), then malloc returned NULL, and errno is
whatever malloc set it to. */
extern int uuconf_add_block (void *uuconf_pblock, void *uuconf_padd);
/* Free a value returned by uuconf_malloc from a memory block. In the
current implementation, this will normally not do anything, but it
doesn't hurt. No errors can occur. */
extern void uuconf_free (void *uuconf_pblock, void *uuconf_pfree);
/* Free an entire memory block, including all values returned by
uuconf_malloc from it and all values added to it with
uuconf_add_block. No errors can occur. */
extern void uuconf_free_block (void *uuconf_pblock);
#else /* ! UUCONF_ANSI_C */
extern UUCONF_POINTER uuconf_malloc_block ();
extern UUCONF_POINTER uuconf_malloc ();
extern int uuconf_add_block ();
extern /* void */ uuconf_free ();
extern /* void */ uuconf_free_block ();
#endif /* ! UUCONF_ANSI_C */
#endif /* ! defined (UUCONF_H) */
|