openenvutils/telnetserver/inc/ext.h
changeset 0 2e3d3ce01487
equal deleted inserted replaced
-1:000000000000 0:2e3d3ce01487
       
     1 /*
       
     2  * Copyright (c) 1989, 1993
       
     3  *	The Regents of the University of California.  All rights reserved.
       
     4  *
       
     5  * Redistribution and use in source and binary forms, with or without
       
     6  * modification, are permitted provided that the following conditions
       
     7  * are met:
       
     8  * 1. Redistributions of source code must retain the above copyright
       
     9  *    notice, this list of conditions and the following disclaimer.
       
    10  * 2. Redistributions in binary form must reproduce the above copyright
       
    11  *    notice, this list of conditions and the following disclaimer in the
       
    12  *    documentation and/or other materials provided with the distribution.
       
    13  * 3. Neither the name of the University nor the names of its contributors
       
    14  *    may be used to endorse or promote products derived from this software
       
    15  *    without specific prior written permission.
       
    16  *
       
    17  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
       
    18  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
       
    19  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
       
    20  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
       
    21  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
       
    22  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
       
    23  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
       
    24  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
       
    25  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
       
    26  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
       
    27  * SUCH DAMAGE.
       
    28  *
       
    29  *	@(#)ext.h	8.2 (Berkeley) 12/15/93
       
    30  */
       
    31 
       
    32 /* $Heimdal: ext.h,v 1.23 2001/08/29 00:45:22 assar Exp $
       
    33    $NetBSD: ext.h,v 1.2 2003/08/07 09:15:29 agc Exp $ */
       
    34 
       
    35 #ifndef __EXT_H__
       
    36 #define __EXT_H__
       
    37 
       
    38 /*
       
    39  * Telnet server variable declarations
       
    40  */
       
    41 extern char	options[256];
       
    42 extern char	do_dont_resp[256];
       
    43 extern char	will_wont_resp[256];
       
    44 extern int	flowmode;	/* current flow control state */
       
    45 extern int	restartany;	/* restart output on any character state */
       
    46 #ifdef DIAGNOSTICS
       
    47 extern int	diagnostic;	/* telnet diagnostic capabilities */
       
    48 #endif /* DIAGNOSTICS */
       
    49 extern int	require_otp;
       
    50 #ifdef AUTHENTICATION
       
    51 extern int	auth_level;
       
    52 #endif
       
    53 extern const char *new_login;
       
    54 
       
    55 extern slcfun	slctab[NSLC + 1];	/* slc mapping table */
       
    56 
       
    57 extern char	*terminaltype;
       
    58 
       
    59 /*
       
    60  * I/O data buffers, pointers, and counters.
       
    61  */
       
    62 extern char	ptyobuf[BUFSIZ+NETSLOP], *pfrontp, *pbackp;
       
    63 
       
    64 extern char	netibuf[BUFSIZ], *netip;
       
    65 
       
    66 extern char	netobuf[BUFSIZ+NETSLOP], *nfrontp, *nbackp;
       
    67 extern char	*neturg;		/* one past last bye of urgent data */
       
    68 
       
    69 extern int	pcc, ncc;
       
    70 
       
    71 extern int	ourpty, net;
       
    72 extern char	*line;
       
    73 extern int	SYNCHing;		/* we are in TELNET SYNCH mode */
       
    74 
       
    75 int telnet_net_write (unsigned char *str, int len);
       
    76 void net_encrypt (void);
       
    77 int telnet_spin (void);
       
    78 char *telnet_getenv (const char *val);
       
    79 char *telnet_gets (char *prompt, char *result, int length, int echo);
       
    80 void get_slc_defaults (void);
       
    81 void telrcv (void);
       
    82 void send_do (int option, int init);
       
    83 void willoption (int option);
       
    84 void send_dont (int option, int init);
       
    85 void wontoption (int option);
       
    86 void send_will (int option, int init);
       
    87 void dooption (int option);
       
    88 void send_wont (int option, int init);
       
    89 void dontoption (int option);
       
    90 void suboption (void);
       
    91 void doclientstat (void);
       
    92 void send_status (void);
       
    93 void init_termbuf (void);
       
    94 void set_termbuf (void);
       
    95 int spcset (int func, cc_t *valp, cc_t **valpp);
       
    96 void set_utid (void);
       
    97 int getpty (int *ptynum);
       
    98 int tty_isecho (void);
       
    99 int tty_flowmode (void);
       
   100 int tty_restartany (void);
       
   101 void tty_setecho (int on);
       
   102 int tty_israw (void);
       
   103 void tty_binaryin (int on);
       
   104 void tty_binaryout (int on);
       
   105 int tty_isbinaryin (void);
       
   106 int tty_isbinaryout (void);
       
   107 int tty_issofttab (void);
       
   108 void tty_setsofttab (int on);
       
   109 int tty_islitecho (void);
       
   110 void tty_setlitecho (int on);
       
   111 int tty_iscrnl (void);
       
   112 void tty_tspeed (int val);
       
   113 void tty_rspeed (int val);
       
   114 void getptyslave (void);
       
   115 int cleanopen (char *line);
       
   116 void startslave (const char *host, const char *, int autologin, char *autoname);
       
   117 void init_env (void);
       
   118 void start_login (const char *host, int autologin, char *name);
       
   119 void cleanup (int sig);
       
   120 int main (int argc, char **argv);
       
   121 int getterminaltype (char *name, size_t);
       
   122 void _gettermname (void);
       
   123 int terminaltypeok (char *s);
       
   124 void my_telnet ();
       
   125 void interrupt (void);
       
   126 void sendbrk (void);
       
   127 void sendsusp (void);
       
   128 void recv_ayt (void);
       
   129 void doeof (void);
       
   130 void flowstat (void);
       
   131 void clientstat (int code, int parm1, int parm2);
       
   132 int ttloop (void);
       
   133 int stilloob (int s);
       
   134 void ptyflush (void);
       
   135 char *nextitem (char *current);
       
   136 void netclear (void);
       
   137 void netflush (void);
       
   138 void writenet (unsigned char *ptr, int len);
       
   139 void fatal (int f, char *msg);
       
   140 void fatalperror (int f, const char *msg);
       
   141 void fatalperror_errno (int f, const char *msg, int error);
       
   142 void edithost (char *pat, char *host);
       
   143 void putstr (char *s);
       
   144 void putchr (int cc);
       
   145 void putf (char *cp, char *where);
       
   146 void printoption (char *fmt, int option);
       
   147 void printsub (int direction, unsigned char *pointer, int length);
       
   148 void printdata (char *tag, char *ptr, int cnt);
       
   149 int login_tty(int t);
       
   150 
       
   151 #ifdef ENCRYPTION
       
   152 extern void	(*encrypt_output) (unsigned char *, int);
       
   153 extern int	(*decrypt_input) (int);
       
   154 extern char	*nclearto;
       
   155 #endif
       
   156 
       
   157 
       
   158 /*
       
   159  * The following are some clocks used to decide how to interpret
       
   160  * the relationship between various variables.
       
   161  */
       
   162 
       
   163 struct clocks_t{
       
   164     int
       
   165 	system,			/* what the current time is */
       
   166 	echotoggle,		/* last time user entered echo character */
       
   167 	modenegotiated,		/* last time operating mode negotiated */
       
   168 	didnetreceive,		/* last time we read data from network */
       
   169 	ttypesubopt,		/* ttype subopt is received */
       
   170 	tspeedsubopt,		/* tspeed subopt is received */
       
   171 	environsubopt,		/* environ subopt is received */
       
   172 	oenvironsubopt,		/* old environ subopt is received */
       
   173 	xdisplocsubopt,		/* xdisploc subopt is received */
       
   174 	baseline,		/* time started to do timed action */
       
   175 	gotDM;			/* when did we last see a data mark */
       
   176 };
       
   177 extern struct clocks_t clocks;
       
   178 
       
   179 extern int log_unauth;
       
   180 extern int no_warn;
       
   181 
       
   182 extern int def_tspeed, def_rspeed;
       
   183 #ifdef	TIOCSWINSZ
       
   184 extern int def_row, def_col;
       
   185 #endif
       
   186 
       
   187 #ifdef STREAMSPTY
       
   188 extern int really_stream;
       
   189 #endif
       
   190 
       
   191 #ifndef USE_IM
       
   192 # ifdef CRAY
       
   193 #  define USE_IM "Cray UNICOS (%h) (%t)"
       
   194 # endif
       
   195 # ifdef _AIX
       
   196 #  define USE_IM "%s %v.%r (%h) (%t)"
       
   197 # endif
       
   198 # ifndef USE_IM
       
   199 #  define USE_IM "%s %r (%h) (%t)"
       
   200 # endif
       
   201 #endif
       
   202 
       
   203 #define DEFAULT_IM "\r\n\r\n" USE_IM "\r\n\r\n\r\n"
       
   204 
       
   205 #endif /* __EXT_H__ */