home *** CD-ROM | disk | FTP | other *** search
/ NeXTSTEP 3.0 / NeXTSTEP3.0.iso / NextDeveloper / Headers / bsd / arpa / telnet.h < prev    next >
Text File  |  1990-05-09  |  6KB  |  178 lines

  1. /*
  2.  * Copyright (c) 1983 Regents of the University of California.
  3.  * All rights reserved.
  4.  *
  5.  * Redistribution and use in source and binary forms are permitted
  6.  * provided that the above copyright notice and this paragraph are
  7.  * duplicated in all such forms and that any documentation,
  8.  * advertising materials, and other materials related to such
  9.  * distribution and use acknowledge that the software was developed
  10.  * by the University of California, Berkeley.  The name of the
  11.  * University may not be used to endorse or promote products derived
  12.  * from this software without specific prior written permission.
  13.  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
  14.  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
  15.  * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  16.  *
  17.  *    @(#)telnet.h    5.7 (Berkeley) 11/14/89
  18.  */
  19.  
  20. /*
  21.  * Definitions for the TELNET protocol.
  22.  */
  23. #define    IAC    255        /* interpret as command: */
  24. #define    DONT    254        /* you are not to use option */
  25. #define    DO    253        /* please, you use option */
  26. #define    WONT    252        /* I won't use option */
  27. #define    WILL    251        /* I will use option */
  28. #define    SB    250        /* interpret as subnegotiation */
  29. #define    GA    249        /* you may reverse the line */
  30. #define    EL    248        /* erase the current line */
  31. #define    EC    247        /* erase the current character */
  32. #define    AYT    246        /* are you there */
  33. #define    AO    245        /* abort output--but let prog finish */
  34. #define    IP    244        /* interrupt process--permanently */
  35. #define    BREAK    243        /* break */
  36. #define    DM    242        /* data mark--for connect. cleaning */
  37. #define    NOP    241        /* nop */
  38. #define    SE    240        /* end sub negotiation */
  39. #define EOR   !119             /* end of record (transparent mode) */
  40. #define    ABORT    238        /* Abort process */
  41. #define    SUSP    237        /* Suspend process */
  42. #define    xEOF    236        /* End of file: EOF is already used... */
  43.  
  44. #define SYNCH    242        /* for telfunc calls */
  45.  
  46. #ifdef TELCMDS
  47. char *telcmds[] = {
  48.     "EOF", "SUSP", "ABORT", "EOR",
  49.     "SE", "NOP", "DMARK", "BRK", "IP", "AO", "AYT", "EC",
  50.     "EL", "GA", "SB", "WILL", "WONT", "DO", "DONT", "IAC",
  51. };
  52. #define    TELCMD_FIRST    xEOF
  53. #define    TELCMD_LAST    IAC
  54. #define    TELCMD_OK(x)    ((x) <= TELCMD_LAST && (x) >= TELCMD_FIRST)
  55. #define    TELCMD(x)    telcmds[(x)-TELCMD_FIRST]
  56. #endif
  57.  
  58. /* telnet options */
  59. #define TELOPT_BINARY    0    /* 8-bit data path */
  60. #define TELOPT_ECHO    1    /* echo */
  61. #define    TELOPT_RCP    2    /* prepare to reconnect */
  62. #define    TELOPT_SGA    3    /* suppress go ahead */
  63. #define    TELOPT_NAMS    4    /* approximate message size */
  64. #define    TELOPT_STATUS    5    /* give status */
  65. #define    TELOPT_TM    6    /* timing mark */
  66. #define    TELOPT_RCTE    7    /* remote controlled transmission and echo */
  67. #define TELOPT_NAOL     8    /* negotiate about output line width */
  68. #define TELOPT_NAOP     9    /* negotiate about output page size */
  69. #define TELOPT_NAOCRD    10    /* negotiate about CR disposition */
  70. #define TELOPT_NAOHTS    11    /* negotiate about horizontal tabstops */
  71. #define TELOPT_NAOHTD    12    /* negotiate about horizontal tab disposition */
  72. #define TELOPT_NAOFFD    13    /* negotiate about formfeed disposition */
  73. #define TELOPT_NAOVTS    14    /* negotiate about vertical tab stops */
  74. #define TELOPT_NAOVTD    15    /* negotiate about vertical tab disposition */
  75. #define TELOPT_NAOLFD    16    /* negotiate about output LF disposition */
  76. #define TELOPT_XASCII    17    /* extended ascic character set */
  77. #define    TELOPT_LOGOUT    18    /* force logout */
  78. #define    TELOPT_BM    19    /* byte macro */
  79. #define    TELOPT_DET    20    /* data entry terminal */
  80. #define    TELOPT_SUPDUP    21    /* supdup protocol */
  81. #define    TELOPT_SUPDUPOUTPUT 22    /* supdup output */
  82. #define    TELOPT_SNDLOC    23    /* send location */
  83. #define    TELOPT_TTYPE    24    /* terminal type */
  84. #define    TELOPT_EOR    25    /* end or record */
  85. #define    TELOPT_TUID    26    /* TACACS user identification */
  86. #define    TELOPT_OUTMRK    27    /* output marking */
  87. #define    TELOPT_TTYLOC    28    /* terminal location number */
  88. #define    TELOPT_3270REGIME 29    /* 3270 regime */
  89. #define    TELOPT_X3PAD    30    /* X.3 PAD */
  90. #define    TELOPT_NAWS    31    /* window size */
  91. #define    TELOPT_TSPEED    32    /* terminal speed */
  92. #define    TELOPT_LF!1233    /* remote flow control */
  93. #define TELOPT_LINEMODE    34    /* Linemode option */
  94. #define    TELOPT_EXOPL    255    /* extended-options-list */
  95.  
  96. #define    NTELOPTS    (1+TELOPT_LINEMODE)
  97. #ifdef TELOPTS
  98. char *telopts[NTELOPTS] = {
  99.     "BINARY", "ECHO", "RCP", "SUPPRESS GO AHEAD", "NAME",
  100.     "STATUS", "TIMING MARK", "RCTE", "NAOL", "NAOP",
  101.     "NAOCRD", "NAOHTS", "NAOHTD", "NAOFFD", "NAOVTS",
  102.     "NAOVTD", "NAOLFD", "EXTEND ASCII", "LOGOUT", "BYTE MACRO",
  103.     "DATA ENTRY TERMINAL", "SUPDUP", "SUPDUP OUTPUT",
  104.     "SEND LOCATION", "TERMINAL TYPE", "END OF RECORD",
  105.     "TACACS UID", "OUTPUT MARKING", "TTYLOC",
  106.     "3270 REGIME", "X.3 PAD", "NAWS", "TSPEED", "LFLOW",
  107.     "LINEMODE",
  108. };
  109. #define    TELOPT_FIRST    TELOPT_BINARY
  110. #define    TELOPT_LAST    TELOPT_LINEMODE
  111. #define    TELOPT_OK(x)    ((x) <= TELOPT_LAST && (x) >= TELOPT_FIRST)
  112. #define    TELOPT(x)    telopts[(x)-TELOPT_FIRST]
  113. #endif
  114.  
  115. /* sub-option qualifiers */
  116. #define    TELQUAL_IS    0    /* option is... */
  117. #define    TELQUAL_SEND    1    /* send option */
  118.  
  119. /*
  120.  * LINEMODE suboptions
  121.  */
  122.  
  123. #define    LM_MODE        1
  124. #define    LM_FORWARDMASK    2
  125. #define    LM_SLC        3
  126.  
  127. #define    MODE_EDIT    0x01
  128. #define    MODE_TRAPSIG    0x02
  129. #define    MODE_ACK    0x04
  130.  
  131. #define    MODE_MASK    (MODE_EDIT|MODE_TRAPSIG|MODE_ACK)
  132.  
  133. /* Not part of protocol, but needed to simplify things... */
  134. #define MODE_FLOW        0x0100
  135. #define MODE_ECHO        0x0200
  136. #define MODE_INBIN        0x0400
  137. #define MODE_OUTBIN        0x0800
  138. #define MODE_FORCE        0x1000
  139.  
  140. #define    SLC_SYNCH    1
  141. #define    SLC_BRK        2
  142. #define    SLC_IP        3
  143. #define    SLC_AO        4
  144. #define    SLC_AYT        5
  145. #define    SLC_EOR        6
  146. #define    SLC_ABORT    7
  147. #define    SLC_EOF        8
  148. #define    SLC_SUSP    9
  149. #define    SLC_EC        10
  150. #define    SLC_EL        11
  151. #define    SLC_EW        12
  152. #define    SLC_RP        13
  153. #define    SLC_LNEXT    14
  154. #define    SLC_XON        15
  155. #define    SLC_XOFF    16
  156. #define    SLC_FORW1    17
  157. #define    SLC_FORW2    18
  158.  
  159. #define    NSLC        18
  160.  
  161. #define    SLC_NAMES    "0", "SYNCH", "BRK", "IP", "AO", "AYT", "EOR", \
  162.             "ABORT", "EOF", "SUSP", "EC", "EL", "EW", "RP", \
  163.             "LNEXT", "XON", "XOFF", "FORW1", "FORW2"
  164.  
  165. #define    SLC_NOSUPPORT    0
  166. #define    SLC_CANTCHANGE    1
  167. #define    SLC_VARIABLE    2
  168. #define    SLC_DEFAULT    3
  169. #define    SLC_LEVELBITS    0x03
  170.  
  171. #define    SLC_FUNC    0
  172. #define    SLC_FLAGS    1
  173. #define    SLC_VALUE    2
  174.  
  175. #define    SLC_ACK        0x80
  176. #define    SLC_FLUSHIN    0x40
  177. #define    SLC_FLUSHOUT    0x20
  178.