/*
 * telnet.h - Eases the implementation of a telnet client/server.
 *
 * Copyright (c) 2001 Andre Guibert de Bruet. <andre@siliconlandmark.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions, and the following disclaimer,
 *    without modification, immediately at the beginning of the file.
 * 2. The name of the author may not be used to endorse or promote products
 *    derived from this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
 *
 */

/*
 * This file is for use by systems that do not have <arpa/telnet.h>.
 */

/* ASCII codes */
#define BELL                "\x07"   // dec 7  : Bell (Audio or Visual)
#define BS                  "\x08"   // dec 8  : Backspace
#define HT                  "\x09"   // dec 9  : Horizontal tab
#define LF                  "\x0A"   // dec 10 : Line feed
#define VT                  "\x0B"   // dec 11 : Vertical tab
#define FF                  "\x0C"   // dec 12 : Form feed
#define CR                  "\x0D"   // dec 13 : Carriage return

/* Telnet commands */
#define NOP                 "\xFF\xF1"  // IAC, 241 : No operation
#define DM                  "\xFF\xF2"  // IAC, 242 : Data Mark
#define BRK                 "\xFF\xF3"  // IAC, 243 : Break
#define IP                  "\xFF\xF4"  // IAC, 244 : Interrupt process
#define AO                  "\xFF\xF5"  // IAC, 245 : Abort output
#define AYT                 "\xFF\xF6"  // IAC, 246 : Are you there?
#define EC                  "\xFF\xF7"  // IAC, 247 : Erase character
#define EL                  "\xFF\xF8"  // IAC, 248 : Erase line
#define GA                  "\xFF\xF9"  // IAC, 249, : Go ahead
#define SB(x)               "\xFF\xFA" x "\xFF\xF0" // IAC, 250(SB), x, IAC, 240(SE)
#define WILL                "\xFF\xFB"  // IAC, 251 
#define WONT                "\xFF\xFC"  // IAC, 252 
#define DO                  "\xFF\xFD"  // IAC, 253 
#define DONT                "\xFF\xFE"  // IAC, 254 
#define IAC                 "\xFF"      // 255

/* Telnet options */
#define BINARY              "\x00"   // dec 00
#define ECHO                "\x01"   // dec 01
#define RECONNECTION        "\x02"   // dec 02
#define SUPPRESS_GO_AHEAD   "\x03"   // dec 03
#define APPROX_SIZE         "\x04"   // dec 04
#define STATUS              "\x05"   // dec 05
#define TIMING_MARK         "\x06"   // dec 06
#define REMOTE_TRANS_ECHO   "\x07"   // dec 07
#define OUT_LINE_WIDTH      "\x08"   // dec 08
#define OUT_PAGE_SIZE       "\x09"   // dec 09
#define OUT_CR_DISPO        "\x0A"   // dec 10
#define OUT_HORIZ_TABSTOPS  "\x0B"   // dec 11
#define OUT_HORIZ_TABDISPO  "\x0C"   // dec 12
#define OUT_FORMFEED_DISPO  "\x0D"   // dec 13
#define OUT_VIRT_TABSTOPS   "\x0E"   // dec 14
#define OUT_VIRT_TABDISPO   "\x0F"   // dec 15
#define OUT_LINEFEED_DISPO  "\x10"   // dec 16
#define EXTENDED_ASCII      "\x11"   // dec 17
#define LOGOUT              "\x12"   // dec 18
#define BYTE_MACRO          "\x13"   // dec 19
#define DATA_ENTRY_TERM     "\x14"   // dec 20
#define SUPDUP              "\x15"   // dec 21
#define SUPDUP_OUTPUT       "\x16"   // dec 22
#define SEND_LOCATION       "\x17"   // dec 23
#define TERMINAL_TYPE       "\x18"   // dec 24
#define END_OF_RECORD       "\x19"   // dec 25
#define TACACS_USER_ID      "\x1A"   // dec 26
#define OUTPUT_MARKING      "\x1B"   // dec 27
#define TERM_LOC_NUM        "\x1C"   // dec 28
#define TELNET_3270         "\x1D"   // dec 29
#define X3_PAD              "\x1E"   // dec 30
#define WINDOW_SIZE         "\x1F"   // dec 31
#define TERMINAL_SPEED      "\x20"   // dec 32
#define REMOTE_FLOW_CONTROL "\x21"   // dec 33
#define LINEMODE            "\x22"   // dec 34
#define X_DISPLAY_LOC       "\x23"   // dec 35
#define ENV_VARIABLES       "\x24"   // dec 36
#define TELNET_AUTH_OPT     "\x25"   // dec 37
#define TELNET_ENV_OPT      "\x27"   // dec 39
