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
|
/* ckctel.h -- Symbol and macro definitions for C-Kermit telnet support */
/*
Authors: Jeffrey E Altman <jaltman@secure-endpoints.com>,
Secure Endpoints Inc., New York City
Frank da Cruz <fdc@columbia.edu>
Columbia University Academic Information Systems, New York City.
Copyright (C) 1985, 2009,
Trustees of Columbia University in the City of New York.
All rights reserved. See the C-Kermit COPYING.TXT file or the
copyright text in the ckcmai.c module for disclaimer and permissions.
Notes:
. This file should be used in place of "arpa/telnet.h"
. Only one source file should include #defines for
TELCMDS, TELOPTS, TELOPT_STATES, SLC_NAMES, and AUTH_NAMES.
*/
#ifndef CKCTEL_H
#define CKCTEL_H
#ifdef TNCODE
/*
Definitions for the TELNET protocol.
can't rely on library header files for any of them.
*/
#ifdef COMMENT
/* In some compilers these are prone to sign extension */
#ifndef IAC /* First the telnet commands */
#define IAC 255
#endif /* IAC */
#ifndef DONT
#define DONT 254
#endif /* DONT */
#ifndef DO
#define DO 253
#endif /* DO */
#ifndef WONT
#define WONT 252
#endif /* WONT */
#ifndef WILL
#define WILL 251
#endif /* WILL */
#ifndef SB
#define SB 250
#endif /* SB */
#ifndef TN_GA
#define TN_GA 249
#endif /* TN_GA */
#ifndef TN_EL
#define TN_EL 248
#endif /* TN_EL */
#ifndef TN_EC
#define TN_EC 247
#endif /* TN_EC */
#ifndef TN_AYT
#define TN_AYT 246
#endif /* TN_AYT */
#ifndef TN_AO
#define TN_AO 245
#endif /* TN_AO */
#ifndef TN_IP
#define TN_IP 244
#endif /* TN_IP */
#ifndef BREAK
#define BREAK 243
#endif /* BREAK */
#ifndef TN_DM
#define TN_DM 242
#endif /* TN_DM */
#ifndef TN_NOP
#define TN_NOP 241
#endif /* TN_NOP */
#ifndef SE
#define SE 240
#endif /* SE */
#ifndef TN_EOR
#define TN_EOR 239
#endif /* TN_EOR */
#ifndef TN_ABORT
#define TN_ABORT 238
#endif /* TN_ABORT */
#ifndef TN_SUSP
#define TN_SUSP 237
#endif /* TN_SUSP */
#ifndef TN_EOF
#define TN_EOF 236
#endif /* TN_EOF */
#ifndef LAST_TN_CMD
#define LAST_TN_CMD 236
#define TN_SAK 200 /* IBM Secure Attention Key */
#endif /* LAST_TN_CMD */
#define SYNCH 242 /* for telfunc calls */
#else
/* Hex notation seems to suppress the sugn extension effect */
#ifndef IAC /* First the telnet commands */
#define IAC 0xff
#endif /* IAC */
#ifndef DONT
#define DONT 0xfe /* 254 */
#endif /* DONT */
#ifndef DO
#define DO 0xfd /* 253 */
#endif /* DO */
#ifndef WONT
#define WONT 0xfc /* 252 */
#endif /* WONT */
#ifndef WILL
#define WILL 0xfb /* 251 */
#endif /* WILL */
#ifndef SB
#define SB 0xfa /* 250 */
#endif /* SB */
#ifndef TN_GA
#define TN_GA 0xf9 /* 249 */
#endif /* TN_GA */
#ifndef TN_EL
#define TN_EL 0xf8 /* 248 */
#endif /* TN_EL */
#ifndef TN_EC
#define TN_EC 0xf7 /* 247 */
#endif /* TN_EC */
#ifndef TN_AYT
#define TN_AYT 0xf6 /* 246 */
#endif /* TN_AYT */
#ifndef TN_AO
#define TN_AO 0xf5 /* 245 */
#endif /* TN_AO */
#ifndef TN_IP
#define TN_IP 0xf4 /* 244 */
#endif /* TN_IP */
#ifndef BREAK
#define BREAK 0xf3 /* 243 */
#endif /* BREAK */
#ifndef TN_DM
#define TN_DM 0xf2 /* 242 */
#endif /* TN_DM */
#ifndef TN_NOP
#define TN_NOP 0xf1 /* 241 */
#endif /* TN_NOP */
#ifndef SE
#define SE 0xf0 /* 240 */
#endif /* SE */
#ifndef TN_EOR
#define TN_EOR 0xef /* 239 */
#endif /* TN_EOR */
#ifndef TN_ABORT
#define TN_ABORT 0xee /* 238 */
#endif /* TN_ABORT */
#ifndef TN_SUSP
#define TN_SUSP 0xed /* 237 */
#endif /* TN_SUSP */
#ifndef TN_EOF
#define TN_EOF 0xec /* 236 */
#endif /* TN_EOF */
#ifndef LAST_TN_CMD
#define LAST_TN_CMD 0xec /* 236 */
#define TN_SAK 0xc8 /* 200 - IBM Secure Attention Key */
#endif /* LAST_TN_CMD */
#define SYNCH 0xf2 /* 242 - for telfunc calls */
#endif /* COMMENT */
#ifdef TELCMDS
char *telcmds[] = {
"EOF", "SUSP", "ABORT", "EOR",
"SE", "NOP", "DMARK", "BRK", "IP", "AO", "AYT", "EC",
"EL", "GA", "SB", "WILL", "WONT", "DO", "DONT", "IAC", 0
};
#else /* TELCMDS */
extern char *telcmds[];
#endif /* TELCMDS */
#define TELCMD_FIRST TN_EOF
#define TELCMD_LAST IAC
#define TELCMD_OK(x) ((unsigned int)(x) <= TELCMD_LAST && \
(unsigned int)(x) >= TELCMD_FIRST || \
(unsigned int)(x) == TN_SAK)
#define TELCMD(x) (TELCMD_OK(x)? ((x) == TN_SAK?"SAK": \
telcmds[(x)-TELCMD_FIRST]):"UNKNOWN")
/* Then the options */
/* NB: the following platforms have TELOPT_AUTHENTICATION defined as */
/* 45 instead of 37. */
#ifdef TELOPT_AUTHENTICATION
#ifdef __osf__
#undef TELOPT_AUTHENTICATION
#endif /* __osf__ */
#ifndef IRIX
#undef TELOPT_AUTHENTICATION
#endif /* IRIX */
#ifndef ultrix
#undef TELOPT_AUTHENTICATION
#endif /* ultrix */
#endif /* TELOPT_AUTHENTICATION */
/* telnet options */
#ifndef TELOPT_BINARY
#define TELOPT_BINARY 0 /* 8-bit data path (RFC 856)*/
#endif
#ifndef TELOPT_ECHO
#define TELOPT_ECHO 1 /* echo (RFC 857)*/
#endif
#ifndef TELOPT_RCP
#define TELOPT_RCP 2 /* prepare to reconnect (NIC 50005)*/
#endif
#ifndef TELOPT_SGA
#define TELOPT_SGA 3 /* suppress go ahead (RFC 858) */
#endif
#ifndef TELOPT_NAMS
#define TELOPT_NAMS 4 /* approximate message size (ETHERNET) */
#endif
#ifndef TELOPT_STATUS
#define TELOPT_STATUS 5 /* give status (RFC 859) */
#endif
#ifndef TELOPT_TM
#define TELOPT_TM 6 /* timing mark (RFC 860) */
#endif
#ifndef TELOPT_RCTE
#define TELOPT_RCTE 7 /* remote controlled transmission and echo */
#endif /* (RFC 726) */
#ifndef TELOPT_NAOL
#define TELOPT_NAOL 8 /* negotiate about output line width */
#endif /* (NIC 50005) */
#ifndef TELOPT_NAOP
#define TELOPT_NAOP 9 /* negotiate about output page size */
#endif /* (NIC 50005) */
#ifndef TELOPT_NAOCRD
#define TELOPT_NAOCRD 10 /* negotiate about CR disposition (RFC 652) */
#endif /* [Historic] */
#ifndef TELOPT_NAOHTS
#define TELOPT_NAOHTS 11 /* negotiate about horizontal tabstops */
#endif /* (RFC 653) [Historic] */
#ifndef TELOPT_NAOHTD
#define TELOPT_NAOHTD 12 /* negotiate about horiz tab disposition */
#endif /* (RFC 654) [Historic] */
#ifndef TELOPT_NAOFFD
#define TELOPT_NAOFFD 13 /* negotiate about formfeed disposition */
#endif /* (RFC 655) [Historic] */
#ifndef TELOPT_NAOVTS
#define TELOPT_NAOVTS 14 /* negotiate about vertical tab stops */
#endif /* (RFC 656) [Historic] */
#ifndef TELOPT_NAOVTD
#define TELOPT_NAOVTD 15 /* negotiate about vertical tab disposition */
#endif /* (RFC 657) [Historic] */
#ifndef TELOPT_NAOLFD
#define TELOPT_NAOLFD 16 /* negotiate about output LF disposition */
#endif /* (RFC 658) [Historic] */
#ifndef TELOPT_XASCII
#define TELOPT_XASCII 17 /* extended ascii character set */
#endif /* (RFC 698) */
#ifndef TELOPT_LOGOUT
#define TELOPT_LOGOUT 18 /* force logout (RFC 727) */
#endif
#ifndef TELOPT_BM
#define TELOPT_BM 19 /* byte macro (RFC 735) */
#endif
#ifndef TELOPT_DET
#define TELOPT_DET 20 /* data entry terminal (RFC 1043, 732) */
#endif
#ifndef TELOPT_SUPDUP
#define TELOPT_SUPDUP 21 /* supdup protocol (RFC 736, 734) */
#endif
#ifndef TELOPT_SUPDUPOUTPUT
#define TELOPT_SUPDUPOUTPUT 22 /* supdup output (RFC 749) */
#endif
#ifndef TELOPT_SNDLOC
#define TELOPT_SNDLOC 23 /* send location (RFC 779) */
#endif
#ifndef TELOPT_TTYPE
#define TELOPT_TTYPE 24 /* terminal type (RFC 1091) */
#endif
#ifndef TELOPT_EOR
#define TELOPT_EOR 25 /* end of record (RFC 885) */
#endif
#ifndef TELOPT_TUID
#define TELOPT_TUID 26 /* TACACS user identification (RFC 927) */
#endif
#ifndef TELOPT_OUTMRK
#define TELOPT_OUTMRK 27 /* output marking (RFC 933) */
#endif
#ifndef TELOPT_TTYLOC
#define TELOPT_TTYLOC 28 /* terminal location number (RFC 946) */
#endif
#ifndef TELOPT_3270REGIME
#define TELOPT_3270REGIME 29 /* 3270 regime (RFC 1041) */
#endif
#ifndef TELOPT_X3PAD
#define TELOPT_X3PAD 30 /* X.3 PAD (RFC 1053) */
#endif
#ifndef TELOPT_NAWS
#define TELOPT_NAWS 31 /* window size (RFC 1073) */
#endif
#ifndef TELOPT_TSPEED
#define TELOPT_TSPEED 32 /* terminal speed (RFC 1079) */
#endif
#ifndef TELOPT_LFLOW
#define TELOPT_LFLOW 33 /* remote flow control (RFC 1372) */
#endif
#ifndef TELOPT_LINEMODE
#define TELOPT_LINEMODE 34 /* Linemode option (RFC 1184) */
#endif
#ifndef TELOPT_XDISPLOC
#define TELOPT_XDISPLOC 35 /* X Display Location (RFC 1096) */
#endif
#ifndef TELOPT_OLD_ENVIRON
#define TELOPT_OLD_ENVIRON 36 /* Old - Environment variables (RFC 1408) */
#endif
#ifndef TELOPT_AUTHENTICATION
#define TELOPT_AUTHENTICATION 37/* Authenticate (RFC 2941) */
#endif
#ifndef TELOPT_ENCRYPTION
#define TELOPT_ENCRYPTION 38 /* Encryption option (RFC 2946) */
#endif
#ifndef TELOPT_NEWENVIRON
#define TELOPT_NEWENVIRON 39 /* New - Environment variables (RFC 1572) */
#endif
#ifndef TELOPT_3270E
#define TELOPT_3270E 40 /* 3270 Extended (RFC 1647) */
#endif
#ifndef TELOPT_XAUTH
#define TELOPT_XAUTH 41 /* ??? (Earhart) */
#endif
#ifndef TELOPT_CHARSET
#define TELOPT_CHARSET 42 /* Character-set (RFC 2066) */
#endif
#ifndef TELOPT_RSP
#define TELOPT_RSP 43 /* Remote Serial Port (Barnes) */
#endif
#ifndef TELOPT_COMPORT
#define TELOPT_COMPORT 44 /* Com Port Control (RFC 2217) */
#endif
#ifndef TELOPT_SLE
#define TELOPT_SLE 45 /* Suppress Local Echo (Atmar) - [rejected] */
#endif
#ifndef TELOPT_START_TLS
#define TELOPT_START_TLS 46 /* Telnet over Transport Layer Security */
#endif /* (Boe) */
#ifndef TELOPT_KERMIT
#define TELOPT_KERMIT 47 /* Kermit (RFC 2840) */
#endif
#ifndef TELOPT_SEND_URL
#define TELOPT_SEND_URL 48 /* Send URL */
#endif
#ifndef TELOPT_FORWARD_X
#define TELOPT_FORWARD_X 49 /* X Windows Forwarding (Altman) */
#endif /* TELOPT_FORWARD_X */
#ifndef TELOPT_STDERR
#define TELOPT_STDERR 50 /* Redirected Stderr (Altman) */
#endif /* TELOPT_STDERR */
#ifndef TELOPT_PRAGMA_LOGON
#define TELOPT_PRAGMA_LOGON 138 /* Encrypted Logon option (PragmaSys) */
#endif
#ifndef TELOPT_SSPI_LOGON
#define TELOPT_SSPI_LOGON 139 /* MS SSPI Logon option (PragmaSys) */
#endif
#ifndef TELOPT_PRAGMA_HEARTBEAT
/* Server Send Heartbeat option (PragmaSys) */
#define TELOPT_PRAGMA_HEARTBEAT 140
#endif
#define TELOPT_IBM_SAK 200 /* IBM Secure Attention Key */
/*
IBM Secure Attention Key (SAK) Option
In addition to terminal negotiation, the telnet command allows
negotiation for the Secure Attention Key (SAK)
option. This option, when supported, provides the local user with
a secure communication path to the remote
host for tasks such as changing user IDs or passwords. If the remote
host supports the SAK function, a trusted
shell is opened on the remote host when the telnet send sak
subcommand is issued. The SAK function can
also be assigned to a single key available in telnet input mode,
using the set sak subcommand.
TN_SAK
Sends the TELNET SAK (Secure Attention Key) sequence, which causes
the remote system to invoke the trusted shell. If the SAK is not
supported, then an error message is displayed that reads:
Remote side does not support SAK.
*/
#ifndef TELOPT_EXOPL
#define TELOPT_EXOPL 255 /* Extended-options-list (RFC 861) */
#endif
#ifdef NTELOPTS
#undef NTELOPTS
#endif /* NTELOPTS */
/* The Telnet Option space is no longer being allocated by ICANN as a */
/* continuous list. In other words it is becoming sparse. But we do */
/* not want to have to allocate memory for a long list of strings and */
/* structs which will never be used. Therefore, the NTELOPTS define */
/* can no longer be equal to TELOPT_LAST+1. In fact, the notion of */
/* TELOPT_FIRST and TELOPT_LAST no longer make sense. */
#define NTELOPTS 55
#define TELOPT_FIRST TELOPT_BINARY
#define TELOPT_LAST TELOPT_IBM_SAK
/*
The following macros speed us up at runtime but are too complex
for some preprocessors / compilers; if your compiler bombs on ckctel.c
with "Instruction table overflow" or somesuch, rebuild with -DNOTOMACROS.
*/
#ifndef NOTOMACROS
#ifndef TELOPT_MACRO
#define TELOPT_MACRO
#endif /* TELOPT_MACRO */
#endif /* NOTOMACROS */
#ifdef TELOPT_MACRO
#define TELOPT_INDEX(x) (((x)>=0 && (x)<= TELOPT_STDERR)?(x):\
((x)>=TELOPT_PRAGMA_LOGON && (x)<=TELOPT_PRAGMA_HEARTBEAT)?(x)-87: \
((x) == TELOPT_IBM_SAK)?(x)-146: NTELOPTS)
#define TELOPT_OK(x) (((x) >= TELOPT_BINARY && (x) <= TELOPT_STDERR) ||\
((x) >= TELOPT_PRAGMA_LOGON && (x) <= TELOPT_PRAGMA_HEARTBEAT) ||\
((x) == TELOPT_IBM_SAK))
#define TELOPT(x) (TELOPT_OK(x)?telopts[TELOPT_INDEX(x)]:"UNKNOWN")
#else /* TELOPT_MACRO */
_PROTOTYP(int telopt_index,(int));
_PROTOTYP(int telopt_ok,(int));
_PROTOTYP(CHAR * telopt, (int));
#define TELOPT_INDEX(x) telopt_index(x)
#define TELOPT_OK(x) telopt_ok(x)
#define TELOPT(x) telopt(x)
#endif /* TELOPT_MACRO */
#ifdef TELOPTS
char *telopts[NTELOPTS+2] = {
/* 0 */ "BINARY", "ECHO", "RCP", "SUPPRESS-GO-AHEAD",
/* 4 */ "NAME", "STATUS", "TIMING-MARK", "RCTE",
/* 8 */ "NAOL", "NAOP", "NAOCRD", "NAOHTS",
/* 12 */ "NAOHTD", "NAOFFD", "NAOVTS", "NAOVTD",
/* 16 */ "NAOLFD", "EXTEND-ASCII", "LOGOUT", "BYTE-MACRO",
/* 20 */ "DATA-ENTRY-TERMINAL", "SUPDUP", "SUPDUP-OUTPUT", "SEND-LOCATION",
/* 24 */ "TERMINAL-TYPE", "END-OF-RECORD", "TACACS-UID", "OUTPUT-MARKING",
/* 28 */ "TTYLOC", "3270-REGIME", "X.3-PAD", "NAWS",
/* 32 */ "TSPEED", "LFLOW", "LINEMODE", "XDISPLOC",
/* 36 */ "OLD-ENVIRON", "AUTHENTICATION", "ENCRYPTION", "NEW-ENVIRONMENT",
/* 40 */ "TN3270E","xauth","CHARSET", "remote-serial-port",
/* 44 */ "COM-PORT-CONTROL","suppress-local-echo","START-TLS","KERMIT",
/* 48 */ "send-url","FORWARD-X","stderr",
/* 138 */ "pragma-logon", "sspi-logon", "pragma-heartbeat",
/* 200 */ "ibm-sak",
"unknown",
0
};
#else /*TELOPTS */
extern char * telopts[];
#endif /* TELOPTS */
/* TELNET Newline Mode */
#define TNL_CR 0 /* CR sends bare carriage return */
#define TNL_CRNUL 1 /* CR and NUL */
#define TNL_CRLF 2 /* CR and LF */
#define TNL_LF 3 /* LF instead of CR */
/* TELNET Negotiation Mode */
#define TN_NG_RF 0 /* Negotiation REFUSED */
#define TN_NG_AC 1 /* Negotiation ACCEPTED */
#define TN_NG_RQ 2 /* Negotiation REQUESTED */
#define TN_NG_MU 3 /* Negotiation REQUIRED (must) */
/* Systems where we know we can define TELNET NAWS automatically. */
#ifndef CK_NAWS /* In other words, if both */
#ifdef CK_TTGWSIZ /* TNCODE and TTGWSIZ are defined */
#define CK_NAWS /* then we can do NAWS. */
#endif /* CK_TTGWSIZ */
#endif /* CK_NAWS */
#ifdef CK_FORWARD_X
#ifndef MAXFWDX
#define MAXFWDX 64 /* Num of X windows to be fwd'd */
#endif /* MAXFWDX */
#endif /* CK_FORWARD_X */
/* Telnet State structures and definitions */
struct _telopt_state {
unsigned char def_server_me_mode; /* Default Negotiation Mode */
unsigned char def_server_u_mode; /* Default Negotiation Mode */
unsigned char def_client_me_mode; /* Default Negotiation Mode */
unsigned char def_client_u_mode; /* Default Negotiation Mode */
unsigned char me_mode; /* Telnet Negotiation Mode */
unsigned char u_mode; /* Telnet Negotiation Mode */
unsigned char me; /* Am I ? */
unsigned char u; /* Are you? */
unsigned char unanswered_will; /* Sent Will, Waiting for DO/DONT */
unsigned char unanswered_do; /* Send DO, Waiting for WILL/WONT */
unsigned char unanswered_wont; /* Sent WONT, Waiting for DONT */
unsigned char unanswered_dont; /* Sent DONT, Waiting for WONT */
unsigned char unanswered_sb; /* Sent SB, Waiting for SB (server) */
union {
#ifdef IKS_OPTION
struct _telopt_kermit { /* Kermit Option States */
unsigned char me_start; /* I have a Server active */
unsigned char me_req_start; /* Sent Req-Start, Waiting for response */
unsigned char me_req_stop; /* Sent Req-Stop, Waiting for response */
unsigned char u_start; /* You have a Server active */
unsigned char sop; /* Have we received the SOP char? */
} kermit;
#endif /* IKS_OPTION */
#ifdef CK_ENCRYPTION
struct _telopt_encrypt { /* Encryption Option States */
unsigned char need_to_send;
unsigned char stop; /* Is encryption stopped? */
} encrypt;
#endif /* CK_ENCRYPTION */
#ifdef CK_NAWS
struct _telopt_naws { /* NAWS Option Information */
unsigned char need_to_send;
int x; /* Last Width */
int y; /* Last Height */
} naws;
#endif /* CK_NAWS */
#ifdef CK_SSL
struct _telopt_start_tls { /* Start TLS Option */
unsigned char u_follows; /* u ready for TLS negotiation */
unsigned char me_follows; /* me ready for TLS negotiation */
unsigned char auth_request; /* Rcvd WILL AUTH before WONT START_TLS */
} start_tls;
#endif /* CK_SSL */
struct _telopt_term { /* Terminal Type */
unsigned char need_to_send;
unsigned char type[41]; /* Last terminal type */
} term;
#ifdef CK_ENVIRONMENT
struct _telopt_new_env {
unsigned char need_to_send;
unsigned char * str;
int len;
} env;
#ifdef CK_XDISPLOC
struct _telopt_xdisp {
unsigned char need_to_send;
} xdisp;
#endif /* CK_XDISPLOC */
#endif /* CK_ENVIRONMENT */
#ifdef CK_SNDLOC
struct _telopt_sndloc {
unsigned char need_to_send;
} sndloc;
#endif /* CK_SNDLOC */
#ifdef CK_FORWARD_X
struct _telopt_fwd_x {
unsigned char need_to_send;
int listen_socket;
struct _channel {
int fd;
int id;
unsigned char need_to_send_xauth;
unsigned char suspend;
} channel[MAXFWDX];
#ifdef NT
int thread_started;
#endif /* NT */
} forward_x;
#endif /* CK_FORWARD_X */
#ifdef TN_COMPORT
struct _telopt_comport {
unsigned char need_to_send;
unsigned char wait_for_sb;
unsigned char wait_for_ms;
} comport;
#endif /* TN_COMPORT */
/* additional options such as New Environment or Send Location */
} sb;
};
typedef struct _telopt_state telopt_state, *p_telopt_state;
/* telopt_states[] is the array of structs which the state of each telnet */
/* option is stored. We allocate one more than we need in case we are */
/* sent telnet options that we do not recognize. If by some chance the */
/* TELOPT_OK() check is skipped, TELOPT_INDEX() will force the option to */
/* use the extra cell. */
#ifdef TELOPT_STATES
telopt_state telopt_states[NTELOPTS+1];
#else /* TELOPT_STATES */
extern telopt_state telopt_states[];
#endif /* TELOPT_STATES */
#define TELOPT_ME(x) (telopt_states[TELOPT_INDEX(x)].me)
#define TELOPT_U(x) (telopt_states[TELOPT_INDEX(x)].u)
#define TELOPT_ME_MODE(x) \
(telopt_states[TELOPT_INDEX(x)].me_mode)
#define TELOPT_U_MODE(x) \
(telopt_states[TELOPT_INDEX(x)].u_mode)
#define TELOPT_UNANSWERED_WILL(x) \
(telopt_states[TELOPT_INDEX(x)].unanswered_will)
#define TELOPT_UNANSWERED_DO(x) \
(telopt_states[TELOPT_INDEX(x)].unanswered_do)
#define TELOPT_UNANSWERED_WONT(x) \
(telopt_states[TELOPT_INDEX(x)].unanswered_wont)
#define TELOPT_UNANSWERED_DONT(x) \
(telopt_states[TELOPT_INDEX(x)].unanswered_dont)
#define TELOPT_UNANSWERED_SB(x) \
(telopt_states[TELOPT_INDEX(x)].unanswered_sb)
#define TELOPT_SB(x) \
(telopt_states[TELOPT_INDEX(x)].sb)
#define TELOPT_DEF_S_ME_MODE(x) \
(telopt_states[TELOPT_INDEX(x)].def_server_me_mode)
#define TELOPT_DEF_S_U_MODE(x) \
(telopt_states[TELOPT_INDEX(x)].def_server_u_mode)
#define TELOPT_DEF_C_ME_MODE(x) \
(telopt_states[TELOPT_INDEX(x)].def_client_me_mode)
#define TELOPT_DEF_C_U_MODE(x) \
(telopt_states[TELOPT_INDEX(x)].def_client_u_mode)
#ifdef TELOPT_MODES
char * telopt_modes[4] = {
"REFUSED", "ACCEPTED", "REQUESTED", "REQUIRED"
};
#else /* TELOPT_MODES */
extern char * telopt_modes[];
#endif /* TELOPT_MODES */
#ifdef TELOPT_MACRO
#define TELOPT_MODE_OK(x) ((unsigned int)(x) <= TN_NG_MU)
#define TELOPT_MODE(x) (TELOPT_MODE_OK(x)?telopt_modes[(x)-TN_NG_RF]:"UNKNOWN")
#else /* TELOPT_MACRO */
_PROTOTYP(int telopt_mode_ok,(int));
_PROTOTYP(CHAR * telopt_mode,(int));
#define TELOPT_MODE_OK(x) telopt_mode_ok(x)
#define TELOPT_MODE(x) telopt_mode(x)
#endif /* TELOPT_MACRO */
/* Sub-option qualifiers */
#define TELQUAL_IS 0 /* option is... */
#define TELQUAL_SEND 1 /* send option */
#define TELQUAL_INFO 2 /* ENVIRON: informational version of IS */
#define TELQUAL_REPLY 2 /* AUTHENTICATION: client version of IS */
#define TELQUAL_NAME 3 /* AUTHENTICATION: client version of IS */
#define TEL_ENV_VAR 0
#define TEL_ENV_VALUE 1
#define TEL_ENV_ESC 2
#define TEL_ENV_USERVAR 3
#define LFLOW_OFF 0 /* Disable remote flow control */
#define LFLOW_ON 1 /* Enable remote flow control */
#define LFLOW_RESTART_ANY 2 /* Restart output on any char */
#define LFLOW_RESTART_XON 3 /* Restart output only on XON */
/*
* LINEMODE suboptions
*/
#define LM_MODE 1
#define LM_FORWARDMASK 2
#define LM_SLC 3
#define MODE_EDIT 0x01
#define MODE_TRAPSIG 0x02
#define MODE_ACK 0x04
#define MODE_SOFT_TAB 0x08
#define MODE_LIT_ECHO 0x10
#define MODE_MASK 0x1f
/* Not part of protocol, but needed to simplify things... */
#define MODE_FLOW 0x0100
#define MODE_ECHO 0x0200
#define MODE_INBIN 0x0400
#define MODE_OUTBIN 0x0800
#define MODE_FORCE 0x1000
#define SLC_SYNCH 1
#define SLC_BRK 2
#define SLC_IP 3
#define SLC_AO 4
#define SLC_AYT 5
#define SLC_EOR 6
#define SLC_ABORT 7
#define SLC_EOF 8
#define SLC_SUSP 9
#define SLC_EC 10
#define SLC_EL 11
#define SLC_EW 12
#define SLC_RP 13
#define SLC_LNEXT 14
#define SLC_XON 15
#define SLC_XOFF 16
#define SLC_FORW1 17
#define SLC_FORW2 18
#define SLC_MCL 19
#define SLC_MCR 20
#define SLC_MCWL 21
#define SLC_MCWR 22
#define SLC_MCBOL 23
#define SLC_MCEOL 24
#define SLC_INSRT 25
#define SLC_OVER 26
#define SLC_ECR 27
#define SLC_EWR 28
#define SLC_EBOL 29
#define SLC_EEOL 30
#define NSLC 30
/*
* For backwards compatability, we define SLC_NAMES to be the
* list of names if SLC_NAMES is not defined.
*/
#define SLC_NAMELIST "0", "SYNCH", "BRK", "IP", "AO", "AYT", "EOR", \
"ABORT", "EOF", "SUSP", "EC", "EL", "EW", "RP", \
"LNEXT", "XON", "XOFF", "FORW1", "FORW2", \
"MCL", "MCR", "MCWL", "MCWR", "MCBOL", "MCEOL", \
"INSRT", "OVER", "ECR", "EWR", "EBOL", "EEOL", 0
#ifdef SLC_NAMES
char *slc_names[] = {
SLC_NAMELIST
};
#else
extern char *slc_names[];
#define SLC_NAMES SLC_NAMELIST
#endif
#define SLC_NAME_OK(x) ((unsigned int)(x) <= NSLC)
#define SLC_NAME(x) (SLC_NAME_OK(x)?slc_names[x]:"UNKNOWN")
#define SLC_NOSUPPORT 0
#define SLC_CANTCHANGE 1
#define SLC_VARIABLE 2
#define SLC_DEFAULT 3
#define SLC_LEVELBITS 0x03
#define SLC_FUNC 0
#define SLC_FLAGS 1
#define SLC_VALUE 2
#define SLC_ACK 0x80
#define SLC_FLUSHIN 0x40
#define SLC_FLUSHOUT 0x20
#define OLD_ENV_VAR 1
#define OLD_ENV_VALUE 0
#define NEW_ENV_VAR 0
#define NEW_ENV_VALUE 1
#define ENV_ESC 2
#define ENV_USERVAR 3
#define FWDX_SCREEN 0
#define FWDX_OPEN 1
#define FWDX_CLOSE 2
#define FWDX_DATA 3
#define FWDX_OPTIONS 4
#define FWDX_OPT_DATA 5
#define FWDX_XOFF 6
#define FWDX_XON 7
#define FWDX_OPT_NONE 0
#define FWDX_OPT_XAUTH 1
/*
* AUTHENTICATION suboptions
*/
/*
* Who is authenticating who ...
*/
#define AUTH_CLIENT_TO_SERVER 0 /* Client authenticating server */
#define AUTH_SERVER_TO_CLIENT 1 /* Server authenticating client */
#define AUTH_WHO_MASK 1
/*
* amount of authentication done
*/
#define AUTH_HOW_ONE_WAY 0
#define AUTH_HOW_MUTUAL 2
#define AUTH_HOW_MASK 2
/*
* should we be encrypting?
*/
#define AUTH_ENCRYPT_OFF 0
#define AUTH_ENCRYPT_USING_TELOPT 4
#define AUTH_ENCRYPT_AFTER_EXCHANGE 16
#define AUTH_ENCRYPT_START_TLS 20
#define AUTH_ENCRYPT_MASK 20
/*
* will we be forwarding?
* if we want to activate the use of this flag then
* #define USE_INI_CRED_FWD
*/
#define INI_CRED_FWD_OFF 0
#define INI_CRED_FWD_ON 8
#define INI_CRED_FWD_MASK 8
#define USE_INI_CRED_FWD
#define AUTHTYPE_NULL 0
#define AUTHTYPE_KERBEROS_V4 1
#define AUTHTYPE_KERBEROS_V5 2
#define AUTHTYPE_SPX 3
#define AUTHTYPE_MINK 4
#define AUTHTYPE_SRP 5
#define AUTHTYPE_RSA 6
#define AUTHTYPE_SSL 7
#define AUTHTYPE_LOKI 10
#define AUTHTYPE_SSA 11
#define AUTHTYPE_KEA_SJ 12
#define AUTHTYPE_KEA_INTEG 13
#define AUTHTYPE_DSS 14
#define AUTHTYPE_NTLM 15
#define AUTHTYPE_GSSAPI_KRB5 16 /* Not allocated by IANA */
#ifdef AUTHTYPE_CNT
#undef AUTHTYPE_CNT
#endif /* AUTHTYPE_CNT */
#define AUTHTYPE_CNT 17
/*
* AUTHTYPEs Last updated 21 March 1999
* from http://www.isi.edu/in-notes/iana/assignments/telnet-options
*/
#define AUTHTYPE_AUTO 99
#ifdef AUTH_NAMES
char *authtype_names[] = {
"NULL", /* RFC 2941 */
"KERBEROS_V4", /* RFC 2941 / 1411 */
"KERBEROS_V5", /* RFC 2941 */
"SPX", /* RFC 2941 (not Internet Standard) */
"MINK", /* RFC 2941 (not Internet Standard) */
"SRP", /* RFC 2944 */
"RSA", /* RFC 2941 (not Internet Standard) */
"SSL", /* RFC 2941 (not Internet Standard) */
"IANA_8", /* not assigned by IANA */
"IANA_9", /* not assigned by IANA */
"LOKI", /* RFC 2941 (not Internet Standard) */
"SSA", /* Schoch */
"KEA_SJ", /* RFC 2951 */
"KEA_SJ_INTEG", /* RFC 2951 */
"DSS", /* RFC 2943 */
"NTLM", /* Kahn <louisk@microsoft.com> */
"GSSAPI-KRB5", /* experimental - altman */
0
};
char * authmode_names[] = {
"CLIENT_TO_SERVER|ONE_WAY",
"SERVER_TO_CLIENT|ONE_WAY",
"CLIENT_TO_SERVER|MUTUAL",
"SERVER_TO_CLIENT|MUTUAL",
"CLIENT_TO_SERVER|ONE_WAY|ENCRYPT_USING_TELOPT",
"SERVER_TO_CLIENT|ONE_WAY|ENCRYPT_USING_TELOPT",
"CLIENT_TO_SERVER|MUTUAL|ENCRYPT_USING_TELOPT",
"SERVER_TO_CLIENT|MUTUAL|ENCRYPT_USING_TELOPT",
"CLIENT_TO_SERVER|ONE_WAY|CRED_FWD",
"SERVER_TO_CLIENT|ONE_WAY|CRED_FWD",
"CLIENT_TO_SERVER|MUTUAL|CRED_FWD",
"SERVER_TO_CLIENT|MUTUAL|CRED_FWD",
"CLIENT_TO_SERVER|ONE_WAY|ENCRYPT_USING_TELOPT|CRED_FWD",
"SERVER_TO_CLIENT|ONE_WAY|ENCRYPT_USING_TELOPT|CRED_FWD",
"CLIENT_TO_SERVER|MUTUAL|ENCRYPT_USING_TELOPT|CRED_FWD",
"SERVER_TO_CLIENT|MUTUAL|ENCRYPT_USING_TELOPT|CRED_FWD",
"CLIENT_TO_SERVER|ONE_WAY|ENCRYPT_AFTER_EXCHANGE",
"SERVER_TO_CLIENT|ONE_WAY|ENCRYPT_AFTER_EXCHANGE",
"CLIENT_TO_SERVER|MUTUAL|ENCRYPT_AFTER_EXCHANGE",
"SERVER_TO_CLIENT|MUTUAL|ENCRYPT_AFTER_EXCHANGE",
"CLIENT_TO_SERVER|ONE_WAY|ENCRYPT_START_TLS",
"SERVER_TO_CLIENT|ONE_WAY|ENCRYPT_START_TLS",
"CLIENT_TO_SERVER|MUTUAL|ENCRYPT_START_TLS",
"SERVER_TO_CLIENT|MUTUAL|ENCRYPT_START_TLS",
"CLIENT_TO_SERVER|ONE_WAY|ENCRYPT_AFTER_EXCHANGE|CRED_FWD",
"SERVER_TO_CLIENT|ONE_WAY|ENCRYPT_AFTER_EXCHANGE|CRED_FWD",
"CLIENT_TO_SERVER|MUTUAL|ENCRYPT_AFTER_EXCHANGE|CRED_FWD",
"SERVER_TO_CLIENT|MUTUAL|ENCRYPT_AFTER_EXCHANGE|CRED_FWD",
"CLIENT_TO_SERVER|ONE_WAY|ENCRYPT_START_TLS|CRED_FWD",
"SERVER_TO_CLIENT|ONE_WAY|ENCRYPT_START_TLS|CRED_FWD",
"CLIENT_TO_SERVER|MUTUAL|ENCRYPT_START_TLS|CRED_FWD",
"SERVER_TO_CLIENT|MUTUAL|ENCRYPT_START_TLS|CRED_FWD",
0
};
#else
extern char *authtype_names[];
extern char *authmode_names[];
#endif
#define AUTHMODE_CNT 32
#define AUTHTYPE_NAME_OK(x) ((unsigned int)(x) < AUTHTYPE_CNT)
#define AUTHTYPE_NAME(x) (AUTHTYPE_NAME_OK(x)?authtype_names[x]:"UNKNOWN")
#define AUTHMODE_NAME_OK(x) ((unsigned int)(x) < AUTHMODE_CNT)
#define AUTHMODE_NAME(x) (AUTHMODE_NAME_OK(x)?authmode_names[x]:"UNKNOWN")
/* Kerberos Authentication Message Identifiers */
#define KRB_AUTH 0 /* Authentication data follows */
#define KRB_REJECT 1 /* Rejected (reason might follow) */
#define KRB_ACCEPT 2 /* Accepted */
#define KRB4_CHALLENGE 3
#define KRB4_RESPONSE 4
#define KRB5_RESPONSE 3 /* Response for mutual auth. */
#define KRB5_FORWARD 4 /* Forwarded credentials follow */
#define KRB5_FORWARD_ACCEPT 5 /* Forwarded credentials accepted */
#define KRB5_FORWARD_REJECT 6 /* Forwarded credentials rejected */
#define KRB5_TLS_VERIFY 7 /* TLS Finished Msg verifier */
/* GSSAPI-KRB5 Authentication Message Identifiers */
#define GSS_AUTH_DATA 0 /* Authentication data follows */
#define GSS_REJECT 1 /* Rejected (reason might follow) */
#define GSS_ACCEPT 2 /* Accepted (username might follow) */
#define GSS_CONTINUE 3
/* Secure Remote Password Authentication Message Identifiers */
#define SRP_AUTH 0 /* Authentication data follows */
#define SRP_REJECT 1 /* Rejected (reason might follow) */
#define SRP_ACCEPT 2 /* Accepted */
#define SRP_CHALLENGE 3
#define SRP_RESPONSE 4
#define SRP_EXP 8 /* */
#define SRP_PARAMS 9 /* */
/* Telnet Auth using KEA and SKIPJACK */
#define KEA_CERTA_RA 1
#define KEA_CERTB_RB_IVB_NONCEB 2
#define KEA_IVA_RESPONSEB_NONCEA 3
#define KEA_RESPONSEA 4
/* Tim Hudson's SSL Authentication Message Identifiers */
#define SSL_START 1
#define SSL_ACCEPT 2
#define SSL_REJECT 3
/* Microsoft NTLM Authentication Message Identifiers */
#define NTLM_AUTH 0
#define NTLM_CHALLENGE 1
#define NTLM_RESPONSE 2
#define NTLM_ACCEPT 3
#define NTLM_REJECT 4
/* Generic Constants */
#define AUTH_SUCCESS 0
#define AUTH_FAILURE 255
/*
* ENCRYPTion suboptions
*/
#define ENCRYPT_IS 0 /* I pick encryption type ... */
#define ENCRYPT_SUPPORT 1 /* I support encryption types ... */
#define ENCRYPT_REPLY 2 /* Initial setup response */
#define ENCRYPT_START 3 /* Am starting to send encrypted */
#define ENCRYPT_END 4 /* Am ending encrypted */
#define ENCRYPT_REQSTART 5 /* Request you start encrypting */
#define ENCRYPT_REQEND 6 /* Request you send encrypting */
#define ENCRYPT_ENC_KEYID 7
#define ENCRYPT_DEC_KEYID 8
#define ENCRYPT_CNT 9
#define ENCTYPE_ANY 0
#define ENCTYPE_DES_CFB64 1
#define ENCTYPE_DES_OFB64 2
#define ENCTYPE_DES3_CFB64 3
#define ENCTYPE_DES3_OFB64 4
#define ENCTYPE_CAST5_40_CFB64 8
#define ENCTYPE_CAST5_40_OFB64 9
#define ENCTYPE_CAST128_CFB64 10
#define ENCTYPE_CAST128_OFB64 11
#ifdef ENCTYPE_CNT
#undef ENCTYPE_CNT
#endif
#define ENCTYPE_CNT 12
#ifdef ENCRYPT_NAMES
char *encrypt_names[] = {
"IS", "SUPPORT", "REPLY", "START", "END",
"REQUEST-START", "REQUEST-END", "ENC-KEYID", "DEC-KEYID",
0
};
char *enctype_names[] = {
"ANY",
"DES_CFB64", /* RFC 2952 */
"DES_OFB64", /* RFC 2953 */
"DES3_CFB64", /* RFC 2947 */
"DES3_OFB64", /* RFC 2948 */
"UNKNOWN-5",
"UNKNOWN-6",
"UNKNOWN-7",
"CAST5_40_CFB64", /* RFC 2950 */
"CAST5_40_OFB64", /* RFC 2949 */
"CAST128_CFB64", /* RFC 2950*/
"CAST128_OFB64", /* RFC 2949 */
0
};
#else
extern char *encrypt_names[];
extern char *enctype_names[];
#endif
#define ENCRYPT_NAME_OK(x) ((unsigned int)(x) < ENCRYPT_CNT)
#define ENCRYPT_NAME(x) (ENCRYPT_NAME_OK(x)?encrypt_names[x]:"UNKNOWN")
#define ENCTYPE_NAME_OK(x) ((unsigned int)(x) < ENCTYPE_CNT)
#define ENCTYPE_NAME(x) (ENCTYPE_NAME_OK(x)?enctype_names[x]:"UNKNOWN")
/* For setting the state of validUser */
#define AUTH_REJECT 0 /* Rejected */
#define AUTH_UNKNOWN 1 /* We don't know who he is, but he's okay */
#define AUTH_OTHER 2 /* We know him, but not his name */
#define AUTH_USER 3 /* We know he name */
#define AUTH_VALID 4 /* We know him, and he needs no password */
/* Kermit Option Subnegotiations */
#define KERMIT_START 0
#define KERMIT_STOP 1
#define KERMIT_REQ_START 2
#define KERMIT_REQ_STOP 3
#define KERMIT_SOP 4
#define KERMIT_RESP_START 8
#define KERMIT_RESP_STOP 9
/* For SET TELNET AUTH HOW */
#define TN_AUTH_HOW_ANY 0
#define TN_AUTH_HOW_ONE_WAY 1
#define TN_AUTH_HOW_MUTUAL 2
/* For SET TELNET AUTH ENCRYPT */
#define TN_AUTH_ENC_ANY 0
#define TN_AUTH_ENC_NONE 1
#define TN_AUTH_ENC_TELOPT 2
#define TN_AUTH_ENC_EXCH 3 /* not used in Kermit */
#define TN_AUTH_ENC_TLS 4
/* Telnet protocol functions defined in C-Kermit */
_PROTOTYP( int tn_ini, (void) ); /* Telnet protocol support */
_PROTOTYP( int tn_reset, (void));
_PROTOTYP( int tn_set_modes, (void));
_PROTOTYP( int tn_sopt, (int, int) );
_PROTOTYP( int tn_doop, (CHAR, int, int (*)(int) ) );
_PROTOTYP( int tn_sttyp, (void) );
_PROTOTYP( int tn_snenv, (CHAR *, int) ) ;
_PROTOTYP( int tn_rnenv, (CHAR *, int) ) ;
_PROTOTYP( int tn_wait, (char *) ) ;
_PROTOTYP( int tn_push, (void) ) ;
_PROTOTYP( int tnsndbrk, (void) );
_PROTOTYP( VOID tn_debug, (char *));
_PROTOTYP( int tn_hex, (CHAR *, int, CHAR *, int));
_PROTOTYP( unsigned char * tn_get_display, (void));
#ifdef IKS_OPTION
_PROTOTYP( int tn_siks, (int) );
_PROTOTYP( int iks_wait, (int, int) );
#endif /* IKS_OPTION */
#ifdef CK_NAWS
_PROTOTYP( int tn_snaws, (void) );
#endif /* CK_NAWS */
#ifdef CK_XDISPLOC
_PROTOTYP( int tn_sxdisploc, (void) );
#endif /* CK_XDISPLOC */
#ifdef CK_SNDLOC
_PROTOTYP( int tn_sndloc, (void) );
#endif /* CK_SNDLOC */
#ifdef CK_FORWARD_X
/* From Xauth.h */
typedef struct xauth {
unsigned short family;
unsigned short address_length;
char *address;
unsigned short number_length;
char *number;
unsigned short name_length;
char *name;
unsigned short data_length;
char *data;
} Xauth;
#include <stdio.h>
/* from X.h */
#define FamilyInternet 0
#define FamilyDECnet 1
#define FamilyChaos 2
# define FamilyLocal (256) /* not part of X standard (i.e. X.h) */
# define FamilyWild (65535)
# define FamilyNetname (254) /* not part of X standard */
# define FamilyKrb5Principal (253) /* Kerberos 5 principal name */
# define FamilyLocalHost (252) /* for local non-net authentication */
char *XauFileName();
Xauth *XauReadAuth(
FILE* /* auth_file */
);
int XauWriteAuth(
FILE* /* auth_file */,
Xauth* /* auth */
);
Xauth *XauGetAuthByName(
const char* /* display_name */
);
Xauth *XauGetAuthByAddr(
unsigned int /* family */,
unsigned int /* address_length */,
const char* /* address */,
unsigned int /* number_length */,
const char* /* number */,
unsigned int /* name_length */,
const char* /* name */
);
void XauDisposeAuth(
Xauth* /* auth */
);
_PROTOTYP( int fwdx_create_listen_socket,(int));
_PROTOTYP( int fwdx_open_client_channel,(int));
_PROTOTYP( int fwdx_open_server_channel,(VOID));
_PROTOTYP( int fwdx_close_channel,(int));
_PROTOTYP( int fwdx_write_data_to_channel,(int, char *,int));
_PROTOTYP( int fwdx_send_data_from_channel,(int, char *,int));
_PROTOTYP( int fwdx_close_all,(VOID));
_PROTOTYP( int fwdx_tn_sb,(unsigned char *, int));
_PROTOTYP( int tn_sndfwdx, (void));
_PROTOTYP( int fwdx_send_close,(int));
_PROTOTYP( int fwdx_send_open,(int));
_PROTOTYP( int fwdx_client_reply_options,(char *, int));
_PROTOTYP( int fwdx_send_options,(VOID));
_PROTOTYP( VOID fwdx_check_sockets,(fd_set *));
_PROTOTYP( int fwdx_init_fd_set,(fd_set *));
_PROTOTYP( int fwdx_authorize_channel, (int, unsigned char *, int));
_PROTOTYP( int fwdx_create_fake_xauth, (char *, int, int));
_PROTOTYP( int fwdx_send_xauth_to_xserver, (int, unsigned char *, int len));
_PROTOTYP( int fwdx_server_avail, (VOID));
_PROTOTYP( int fwdx_parse_displayname, (char *, int *, char **, int *, int *, char **));
#ifdef NT
_PROTOTYP( VOID fwdx_thread,(VOID *));
#endif /* NT */
#endif /* CK_FORWARD_X */
#ifdef TN_COMPORT
#define TNC_C2S_SIGNATURE 0
#define TNC_C2S_SET_BAUDRATE 1
#define TNC_C2S_SET_DATASIZE 2
#define TNC_C2S_SET_PARITY 3
#define TNC_C2S_SET_STOPSIZE 4
#define TNC_C2S_SET_CONTROL 5
#define TNC_C2S_NOTIFY_LINESTATE 6
#define TNC_C2S_NOTIFY_MODEMSTATE 7
#define TNC_C2S_FLOW_SUSPEND 8
#define TNC_C2S_FLOW_RESUME 9
#define TNC_C2S_SET_LS_MASK 10
#define TNC_C2S_SET_MS_MASK 11
#define TNC_C2S_PURGE 12
#define TNC_S2C_SIGNATURE 100
#define TNC_S2C_SET_BAUDRATE 101
#define TNC_S2C_SET_DATASIZE 102
#define TNC_S2C_SET_PARITY 103
#define TNC_S2C_SET_STOPSIZE 104
#define TNC_S2C_SET_CONTROL 105
#define TNC_S2C_SEND_LS 106
#define TNC_S2C_SEND_MS 107
#define TNC_S2C_FLOW_SUSPEND 108
#define TNC_S2C_FLOW_RESUME 109
#define TNC_S2C_SET_LS_MASK 110
#define TNC_S2C_SET_MS_MASK 111
#define TNC_S2C_PURGE 112
/* The COMPORT values are not defined in RFC 2217 */
#define TNC_BPS_REQUEST 0
#define TNC_BPS_300 3
#define TNC_BPS_600 4
#define TNC_BPS_1200 5
#define TNC_BPS_2400 6
#define TNC_BPS_4800 7
#define TNC_BPS_9600 8
#define TNC_BPS_14400 9
#define TNC_BPS_19200 10
#define TNC_BPS_28800 11
#define TNC_BPS_38400 12
#define TNC_BPS_57600 13
#define TNC_BPS_115200 14
#define TNC_BPS_230400 15
#define TNC_BPS_460800 16
#define TNC_DS_REQUEST 0
#define TNC_DS_5 5
#define TNC_DS_6 6
#define TNC_DS_7 7
#define TNC_DS_8 8
#define TNC_PAR_REQUEST 0
#define TNC_PAR_NONE 1
#define TNC_PAR_ODD 2
#define TNC_PAR_EVEN 3
#define TNC_PAR_MARK 4
#define TNC_PAR_SPACE 5
#define TNC_SB_REQUEST 0
#define TNC_SB_1 1
#define TNC_SB_1_5 3
#define TNC_SB_2 2
#define TNC_CTL_OFLOW_REQUEST 0
#define TNC_CTL_OFLOW_NONE 1
#define TNC_CTL_OFLOW_XON_XOFF 2
#define TNC_CTL_OFLOW_RTS_CTS 3
#define TNC_CTL_OFLOW_DCD 17
#define TNC_CTL_OFLOW_DSR 19
#define TNC_CTL_BREAK_REQUEST 4
#define TNC_CTL_BREAK_ON 5
#define TNC_CTL_BREAK_OFF 6
#define TNC_CTL_DTR_REQUEST 7
#define TNC_CTL_DTR_ON 8
#define TNC_CTL_DTR_OFF 9
#define TNC_CTL_RTS_REQUEST 10
#define TNC_CTL_RTS_ON 11
#define TNC_CTL_RTS_OFF 12
#define TNC_CTL_IFLOW_REQUEST 13
#define TNC_CTL_IFLOW_NONE 14
#define TNC_CTL_IFLOW_XON_XOFF 15
#define TNC_CTL_IFLOW_RTS_CTS 16
#define TNC_CTL_IFLOW_DTR 18
#define TNC_MS_DATA_READY 1
#define TNC_MS_OVERRUN_ERROR 2
#define TNC_MS_PARITY_ERROR 4
#define TNC_MS_FRAME_ERROR 8
#define TNC_MS_BREAK_ERROR 16
#define TNC_MS_HR_EMPTY 32
#define TNC_MS_SR_EMPTY 64
#define TNC_MS_TIMEOUT_ERROR 128
#define TNC_MS_CTS_DELTA 1
#define TNC_MS_DSR_DELTA 2
#define TNC_MS_EDGE_RING 4
#define TNC_MS_RLSD_DELTA 8
#define TNC_MS_CTS_SIG 16
#define TNC_MS_DSR_SIG 32
#define TNC_MS_RI_SIG 64
#define TNC_MS_RLSD_SIG 128
#define TNC_PURGE_RECEIVE 1
#define TNC_PURGE_TRANSMIT 2
#define TNC_PURGE_BOTH 3
#ifdef TNC_NAMES
char *tnc_names[] = {
"SIGNATURE", "SET-BAUDRATE", "SET-DATARATE", "SET-PARITY", "SET-STOPSIZE",
"SET-CONTROL", "NOTIFY-LINESTATE", "NOTIFY-MODEMSTATE",
"FLOWCONTROL-SUSPEND", "FLOWCONTROL-RESUME", "SET-LINESTATE-MASK",
"SET-MODEMSTATE-MASK", "PURGE-DATA",
0
};
#else
extern char *tnc_names[];
#endif
#define TNC_NAME_OK(x) ((x) >= 0 && (x) <= 12 || (x) >= 100 && (x) <= 112)
#define TNC_NAME(x) \
(TNC_NAME_OK(x)?tnc_names[(x)>=100?(x)-100:(x)]:"UNKNOWN")
_PROTOTYP(int tnc_init,(void));
_PROTOTYP(int tnc_wait,(CHAR *, int));
_PROTOTYP(int tnc_tn_sb,(CHAR *,int));
_PROTOTYP(CONST char * tnc_get_signature, (void));
_PROTOTYP(int tnc_send_signature, (char *));
_PROTOTYP(int tnc_set_baud,(long));
_PROTOTYP(int tnc_get_baud,(void));
_PROTOTYP(int tnc_set_datasize,(int));
_PROTOTYP(int tnc_get_datasize,(void));
_PROTOTYP(int tnc_set_parity,(int));
_PROTOTYP(int tnc_get_parity,(void));
_PROTOTYP(int tnc_set_stopsize,(int));
_PROTOTYP(int tnc_get_stopsize,(void));
_PROTOTYP(int tnc_set_oflow,(int));
_PROTOTYP(int tnc_get_oflow,(void));
_PROTOTYP(int tnc_set_iflow,(int));
_PROTOTYP(int tnc_get_iflow,(void));
_PROTOTYP(int tnc_set_break_state,(int));
_PROTOTYP(int tnc_get_break_state,(void));
_PROTOTYP(int tnc_set_dtr_state,(int));
_PROTOTYP(int tnc_get_dtr_state,(void));
_PROTOTYP(int tnc_set_rts_state,(int));
_PROTOTYP(int tnc_get_rts_state,(void));
_PROTOTYP(int tnc_set_ls_mask,(int));
_PROTOTYP(int tnc_get_ls_mask,(void));
_PROTOTYP(int tnc_get_ls,(void));
_PROTOTYP(int tnc_set_ms_mask,(int));
_PROTOTYP(int tnc_get_ms_mask,(void));
_PROTOTYP(int tnc_get_ms,(void));
_PROTOTYP(int tnc_send_purge_data,(int));
_PROTOTYP(int tnc_flow_suspended,(void));
_PROTOTYP(int tnc_suspend_flow,(void));
_PROTOTYP(int tnc_resume_flow,(void));
/* The following methods are to be called by ck?tio.c routines */
_PROTOTYP(int tnsetflow,(int));
_PROTOTYP(int tnsettings,(int,int));
_PROTOTYP(int tngmdm,(void));
_PROTOTYP(int tnsndb,(long));
_PROTOTYP(int istncomport,(void));
_PROTOTYP(int tn_sndcomport,(void));
#endif /* TN_COMPORT */
#ifndef CKCTEL_C /* These are declared in ckctel.c */
extern int tn_init; /* Telnet protocol initialized flag */
extern char *tn_term; /* Terminal type override */
extern int sstelnet; /* Server side telnet? */
extern int tn_deb; /* Telnet option debugging flag */
extern int tn_auth_krb5_des_bug; /* Telnet BUG */
#endif /* CKCTEL_C */
#define TN_MSG_LEN 12292
#endif /* TNCODE */
#endif /* CKCTEL_H */
|