|
|
1.1 ! root 1: /* ! 2: * Copyright (c) 1999 Apple Computer, Inc. All rights reserved. ! 3: * ! 4: * @APPLE_LICENSE_HEADER_START@ ! 5: * ! 6: * Portions Copyright (c) 1999 Apple Computer, Inc. All Rights ! 7: * Reserved. This file contains Original Code and/or Modifications of ! 8: * Original Code as defined in and that are subject to the Apple Public ! 9: * Source License Version 1.1 (the "License"). You may not use this file ! 10: * except in compliance with the License. Please obtain a copy of the ! 11: * License at http://www.apple.com/publicsource and read it before using ! 12: * this file. ! 13: * ! 14: * The Original Code and all software distributed under the License are ! 15: * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER ! 16: * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, ! 17: * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, ! 18: * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the ! 19: * License for the specific language governing rights and limitations ! 20: * under the License. ! 21: * ! 22: * @APPLE_LICENSE_HEADER_END@ ! 23: */ ! 24: ! 25: /* ! 26: * Copyright (c) 1983, 1993 ! 27: * The Regents of the University of California. All rights reserved. ! 28: * ! 29: * Redistribution and use in source and binary forms, with or without ! 30: * modification, are permitted provided that the following conditions ! 31: * are met: ! 32: * 1. Redistributions of source code must retain the above copyright ! 33: * notice, this list of conditions and the following disclaimer. ! 34: * 2. Redistributions in binary form must reproduce the above copyright ! 35: * notice, this list of conditions and the following disclaimer in the ! 36: * documentation and/or other materials provided with the distribution. ! 37: * 3. All advertising materials mentioning features or use of this software ! 38: * must display the following acknowledgement: ! 39: * This product includes software developed by the University of ! 40: * California, Berkeley and its contributors. ! 41: * 4. Neither the name of the University nor the names of its contributors ! 42: * may be used to endorse or promote products derived from this software ! 43: * without specific prior written permission. ! 44: * ! 45: * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ! 46: * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE ! 47: * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ! 48: * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE ! 49: * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL ! 50: * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS ! 51: * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ! 52: * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT ! 53: * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY ! 54: * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF ! 55: * SUCH DAMAGE. ! 56: * ! 57: * @(#)telnet.h 8.2 (Berkeley) 12/15/93 ! 58: */ ! 59: ! 60: #ifndef _TELNET_H_ ! 61: #define _TELNET_H_ ! 62: ! 63: /* ! 64: * Definitions for the TELNET protocol. ! 65: */ ! 66: #define IAC 255 /* interpret as command: */ ! 67: #define DONT 254 /* you are not to use option */ ! 68: #define DO 253 /* please, you use option */ ! 69: #define WONT 252 /* I won't use option */ ! 70: #define WILL 251 /* I will use option */ ! 71: #define SB 250 /* interpret as subnegotiation */ ! 72: #define GA 249 /* you may reverse the line */ ! 73: #define EL 248 /* erase the current line */ ! 74: #define EC 247 /* erase the current character */ ! 75: #define AYT 246 /* are you there */ ! 76: #define AO 245 /* abort output--but let prog finish */ ! 77: #define IP 244 /* interrupt process--permanently */ ! 78: #define BREAK 243 /* break */ ! 79: #define DM 242 /* data mark--for connect. cleaning */ ! 80: #define NOP 241 /* nop */ ! 81: #define SE 240 /* end sub negotiation */ ! 82: #define EOR 239 /* end of record (transparent mode) */ ! 83: #define ABORT 238 /* Abort process */ ! 84: #define SUSP 237 /* Suspend process */ ! 85: #define xEOF 236 /* End of file: EOF is already used... */ ! 86: ! 87: #define SYNCH 242 /* for telfunc calls */ ! 88: ! 89: #ifdef TELCMDS ! 90: char *telcmds[] = { ! 91: "EOF", "SUSP", "ABORT", "EOR", ! 92: "SE", "NOP", "DMARK", "BRK", "IP", "AO", "AYT", "EC", ! 93: "EL", "GA", "SB", "WILL", "WONT", "DO", "DONT", "IAC", 0, ! 94: }; ! 95: #else ! 96: extern char *telcmds[]; ! 97: #endif ! 98: ! 99: #define TELCMD_FIRST xEOF ! 100: #define TELCMD_LAST IAC ! 101: #define TELCMD_OK(x) ((unsigned int)(x) <= TELCMD_LAST && \ ! 102: (unsigned int)(x) >= TELCMD_FIRST) ! 103: #define TELCMD(x) telcmds[(x)-TELCMD_FIRST] ! 104: ! 105: /* telnet options */ ! 106: #define TELOPT_BINARY 0 /* 8-bit data path */ ! 107: #define TELOPT_ECHO 1 /* echo */ ! 108: #define TELOPT_RCP 2 /* prepare to reconnect */ ! 109: #define TELOPT_SGA 3 /* suppress go ahead */ ! 110: #define TELOPT_NAMS 4 /* approximate message size */ ! 111: #define TELOPT_STATUS 5 /* give status */ ! 112: #define TELOPT_TM 6 /* timing mark */ ! 113: #define TELOPT_RCTE 7 /* remote controlled transmission and echo */ ! 114: #define TELOPT_NAOL 8 /* negotiate about output line width */ ! 115: #define TELOPT_NAOP 9 /* negotiate about output page size */ ! 116: #define TELOPT_NAOCRD 10 /* negotiate about CR disposition */ ! 117: #define TELOPT_NAOHTS 11 /* negotiate about horizontal tabstops */ ! 118: #define TELOPT_NAOHTD 12 /* negotiate about horizontal tab disposition */ ! 119: #define TELOPT_NAOFFD 13 /* negotiate about formfeed disposition */ ! 120: #define TELOPT_NAOVTS 14 /* negotiate about vertical tab stops */ ! 121: #define TELOPT_NAOVTD 15 /* negotiate about vertical tab disposition */ ! 122: #define TELOPT_NAOLFD 16 /* negotiate about output LF disposition */ ! 123: #define TELOPT_XASCII 17 /* extended ascic character set */ ! 124: #define TELOPT_LOGOUT 18 /* force logout */ ! 125: #define TELOPT_BM 19 /* byte macro */ ! 126: #define TELOPT_DET 20 /* data entry terminal */ ! 127: #define TELOPT_SUPDUP 21 /* supdup protocol */ ! 128: #define TELOPT_SUPDUPOUTPUT 22 /* supdup output */ ! 129: #define TELOPT_SNDLOC 23 /* send location */ ! 130: #define TELOPT_TTYPE 24 /* terminal type */ ! 131: #define TELOPT_EOR 25 /* end or record */ ! 132: #define TELOPT_TUID 26 /* TACACS user identification */ ! 133: #define TELOPT_OUTMRK 27 /* output marking */ ! 134: #define TELOPT_TTYLOC 28 /* terminal location number */ ! 135: #define TELOPT_3270REGIME 29 /* 3270 regime */ ! 136: #define TELOPT_X3PAD 30 /* X.3 PAD */ ! 137: #define TELOPT_NAWS 31 /* window size */ ! 138: #define TELOPT_TSPEED 32 /* terminal speed */ ! 139: #define TELOPT_LFLOW 33 /* remote flow control */ ! 140: #define TELOPT_LINEMODE 34 /* Linemode option */ ! 141: #define TELOPT_XDISPLOC 35 /* X Display Location */ ! 142: #define TELOPT_OLD_ENVIRON 36 /* Old - Environment variables */ ! 143: #define TELOPT_AUTHENTICATION 37/* Authenticate */ ! 144: #define TELOPT_ENCRYPT 38 /* Encryption option */ ! 145: #define TELOPT_NEW_ENVIRON 39 /* New - Environment variables */ ! 146: #define TELOPT_EXOPL 255 /* extended-options-list */ ! 147: ! 148: ! 149: #define NTELOPTS (1+TELOPT_NEW_ENVIRON) ! 150: #ifdef TELOPTS ! 151: char *telopts[NTELOPTS+1] = { ! 152: "BINARY", "ECHO", "RCP", "SUPPRESS GO AHEAD", "NAME", ! 153: "STATUS", "TIMING MARK", "RCTE", "NAOL", "NAOP", ! 154: "NAOCRD", "NAOHTS", "NAOHTD", "NAOFFD", "NAOVTS", ! 155: "NAOVTD", "NAOLFD", "EXTEND ASCII", "LOGOUT", "BYTE MACRO", ! 156: "DATA ENTRY TERMINAL", "SUPDUP", "SUPDUP OUTPUT", ! 157: "SEND LOCATION", "TERMINAL TYPE", "END OF RECORD", ! 158: "TACACS UID", "OUTPUT MARKING", "TTYLOC", ! 159: "3270 REGIME", "X.3 PAD", "NAWS", "TSPEED", "LFLOW", ! 160: "LINEMODE", "XDISPLOC", "OLD-ENVIRON", "AUTHENTICATION", ! 161: "ENCRYPT", "NEW-ENVIRON", ! 162: 0, ! 163: }; ! 164: #define TELOPT_FIRST TELOPT_BINARY ! 165: #define TELOPT_LAST TELOPT_NEW_ENVIRON ! 166: #define TELOPT_OK(x) ((unsigned int)(x) <= TELOPT_LAST) ! 167: #define TELOPT(x) telopts[(x)-TELOPT_FIRST] ! 168: #endif ! 169: ! 170: /* sub-option qualifiers */ ! 171: #define TELQUAL_IS 0 /* option is... */ ! 172: #define TELQUAL_SEND 1 /* send option */ ! 173: #define TELQUAL_INFO 2 /* ENVIRON: informational version of IS */ ! 174: #define TELQUAL_REPLY 2 /* AUTHENTICATION: client version of IS */ ! 175: #define TELQUAL_NAME 3 /* AUTHENTICATION: client version of IS */ ! 176: ! 177: #define LFLOW_OFF 0 /* Disable remote flow control */ ! 178: #define LFLOW_ON 1 /* Enable remote flow control */ ! 179: #define LFLOW_RESTART_ANY 2 /* Restart output on any char */ ! 180: #define LFLOW_RESTART_XON 3 /* Restart output only on XON */ ! 181: ! 182: /* ! 183: * LINEMODE suboptions ! 184: */ ! 185: ! 186: #define LM_MODE 1 ! 187: #define LM_FORWARDMASK 2 ! 188: #define LM_SLC 3 ! 189: ! 190: #define MODE_EDIT 0x01 ! 191: #define MODE_TRAPSIG 0x02 ! 192: #define MODE_ACK 0x04 ! 193: #define MODE_SOFT_TAB 0x08 ! 194: #define MODE_LIT_ECHO 0x10 ! 195: ! 196: #define MODE_MASK 0x1f ! 197: ! 198: /* Not part of protocol, but needed to simplify things... */ ! 199: #define MODE_FLOW 0x0100 ! 200: #define MODE_ECHO 0x0200 ! 201: #define MODE_INBIN 0x0400 ! 202: #define MODE_OUTBIN 0x0800 ! 203: #define MODE_FORCE 0x1000 ! 204: ! 205: #define SLC_SYNCH 1 ! 206: #define SLC_BRK 2 ! 207: #define SLC_IP 3 ! 208: #define SLC_AO 4 ! 209: #define SLC_AYT 5 ! 210: #define SLC_EOR 6 ! 211: #define SLC_ABORT 7 ! 212: #define SLC_EOF 8 ! 213: #define SLC_SUSP 9 ! 214: #define SLC_EC 10 ! 215: #define SLC_EL 11 ! 216: #define SLC_EW 12 ! 217: #define SLC_RP 13 ! 218: #define SLC_LNEXT 14 ! 219: #define SLC_XON 15 ! 220: #define SLC_XOFF 16 ! 221: #define SLC_FORW1 17 ! 222: #define SLC_FORW2 18 ! 223: ! 224: #define NSLC 18 ! 225: ! 226: /* ! 227: * For backwards compatability, we define SLC_NAMES to be the ! 228: * list of names if SLC_NAMES is not defined. ! 229: */ ! 230: #define SLC_NAMELIST "0", "SYNCH", "BRK", "IP", "AO", "AYT", "EOR", \ ! 231: "ABORT", "EOF", "SUSP", "EC", "EL", "EW", "RP", \ ! 232: "LNEXT", "XON", "XOFF", "FORW1", "FORW2", 0, ! 233: #ifdef SLC_NAMES ! 234: char *slc_names[] = { ! 235: SLC_NAMELIST ! 236: }; ! 237: #else ! 238: extern char *slc_names[]; ! 239: #define SLC_NAMES SLC_NAMELIST ! 240: #endif ! 241: ! 242: #define SLC_NAME_OK(x) ((unsigned int)(x) <= NSLC) ! 243: #define SLC_NAME(x) slc_names[x] ! 244: ! 245: #define SLC_NOSUPPORT 0 ! 246: #define SLC_CANTCHANGE 1 ! 247: #define SLC_VARIABLE 2 ! 248: #define SLC_DEFAULT 3 ! 249: #define SLC_LEVELBITS 0x03 ! 250: ! 251: #define SLC_FUNC 0 ! 252: #define SLC_FLAGS 1 ! 253: #define SLC_VALUE 2 ! 254: ! 255: #define SLC_ACK 0x80 ! 256: #define SLC_FLUSHIN 0x40 ! 257: #define SLC_FLUSHOUT 0x20 ! 258: ! 259: #define OLD_ENV_VAR 1 ! 260: #define OLD_ENV_VALUE 0 ! 261: #define NEW_ENV_VAR 0 ! 262: #define NEW_ENV_VALUE 1 ! 263: #define ENV_ESC 2 ! 264: #define ENV_USERVAR 3 ! 265: ! 266: /* ! 267: * AUTHENTICATION suboptions ! 268: */ ! 269: ! 270: /* ! 271: * Who is authenticating who ... ! 272: */ ! 273: #define AUTH_WHO_CLIENT 0 /* Client authenticating server */ ! 274: #define AUTH_WHO_SERVER 1 /* Server authenticating client */ ! 275: #define AUTH_WHO_MASK 1 ! 276: ! 277: /* ! 278: * amount of authentication done ! 279: */ ! 280: #define AUTH_HOW_ONE_WAY 0 ! 281: #define AUTH_HOW_MUTUAL 2 ! 282: #define AUTH_HOW_MASK 2 ! 283: ! 284: #define AUTHTYPE_NULL 0 ! 285: #define AUTHTYPE_KERBEROS_V4 1 ! 286: #define AUTHTYPE_KERBEROS_V5 2 ! 287: #define AUTHTYPE_SPX 3 ! 288: #define AUTHTYPE_MINK 4 ! 289: #define AUTHTYPE_CNT 5 ! 290: ! 291: #define AUTHTYPE_TEST 99 ! 292: ! 293: #ifdef AUTH_NAMES ! 294: char *authtype_names[] = { ! 295: "NULL", "KERBEROS_V4", "KERBEROS_V5", "SPX", "MINK", 0, ! 296: }; ! 297: #else ! 298: extern char *authtype_names[]; ! 299: #endif ! 300: ! 301: #define AUTHTYPE_NAME_OK(x) ((unsigned int)(x) < AUTHTYPE_CNT) ! 302: #define AUTHTYPE_NAME(x) authtype_names[x] ! 303: ! 304: /* ! 305: * ENCRYPTion suboptions ! 306: */ ! 307: #define ENCRYPT_IS 0 /* I pick encryption type ... */ ! 308: #define ENCRYPT_SUPPORT 1 /* I support encryption types ... */ ! 309: #define ENCRYPT_REPLY 2 /* Initial setup response */ ! 310: #define ENCRYPT_START 3 /* Am starting to send encrypted */ ! 311: #define ENCRYPT_END 4 /* Am ending encrypted */ ! 312: #define ENCRYPT_REQSTART 5 /* Request you start encrypting */ ! 313: #define ENCRYPT_REQEND 6 /* Request you send encrypting */ ! 314: #define ENCRYPT_ENC_KEYID 7 ! 315: #define ENCRYPT_DEC_KEYID 8 ! 316: #define ENCRYPT_CNT 9 ! 317: ! 318: #define ENCTYPE_ANY 0 ! 319: #define ENCTYPE_DES_CFB64 1 ! 320: #define ENCTYPE_DES_OFB64 2 ! 321: #define ENCTYPE_CNT 3 ! 322: ! 323: #ifdef ENCRYPT_NAMES ! 324: char *encrypt_names[] = { ! 325: "IS", "SUPPORT", "REPLY", "START", "END", ! 326: "REQUEST-START", "REQUEST-END", "ENC-KEYID", "DEC-KEYID", ! 327: 0, ! 328: }; ! 329: char *enctype_names[] = { ! 330: "ANY", "DES_CFB64", "DES_OFB64", 0, ! 331: }; ! 332: #else ! 333: extern char *encrypt_names[]; ! 334: extern char *enctype_names[]; ! 335: #endif ! 336: ! 337: ! 338: #define ENCRYPT_NAME_OK(x) ((unsigned int)(x) < ENCRYPT_CNT) ! 339: #define ENCRYPT_NAME(x) encrypt_names[x] ! 340: ! 341: #define ENCTYPE_NAME_OK(x) ((unsigned int)(x) < ENCTYPE_CNT) ! 342: #define ENCTYPE_NAME(x) enctype_names[x] ! 343: ! 344: #endif /* !_TELNET_H_ */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.