157416Smarkm/* 257416Smarkm * Copyright (c) 1989, 1993 357416Smarkm * The Regents of the University of California. All rights reserved. 457416Smarkm * 557416Smarkm * Redistribution and use in source and binary forms, with or without 657416Smarkm * modification, are permitted provided that the following conditions 757416Smarkm * are met: 857416Smarkm * 1. Redistributions of source code must retain the above copyright 957416Smarkm * notice, this list of conditions and the following disclaimer. 1057416Smarkm * 2. Redistributions in binary form must reproduce the above copyright 1157416Smarkm * notice, this list of conditions and the following disclaimer in the 1257416Smarkm * documentation and/or other materials provided with the distribution. 1357416Smarkm * 3. All advertising materials mentioning features or use of this software 1457416Smarkm * must display the following acknowledgement: 1557416Smarkm * This product includes software developed by the University of 1657416Smarkm * California, Berkeley and its contributors. 1757416Smarkm * 4. Neither the name of the University nor the names of its contributors 1857416Smarkm * may be used to endorse or promote products derived from this software 1957416Smarkm * without specific prior written permission. 2057416Smarkm * 2157416Smarkm * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 2257416Smarkm * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 2357416Smarkm * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 2457416Smarkm * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 2557416Smarkm * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 2657416Smarkm * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2757416Smarkm * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2857416Smarkm * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2957416Smarkm * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 3057416Smarkm * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 3157416Smarkm * SUCH DAMAGE. 3257416Smarkm * 3357416Smarkm * @(#)ext.h 8.2 (Berkeley) 12/15/93 3457416Smarkm */ 3557416Smarkm 36233294Sstas/* $Id$ */ 3757416Smarkm 3857416Smarkm#ifndef __EXT_H__ 3957416Smarkm#define __EXT_H__ 4057416Smarkm 4157416Smarkm/* 4257416Smarkm * Telnet server variable declarations 4357416Smarkm */ 4457416Smarkmextern char options[256]; 4557416Smarkmextern char do_dont_resp[256]; 4657416Smarkmextern char will_wont_resp[256]; 4757416Smarkmextern int flowmode; /* current flow control state */ 4857416Smarkmextern int restartany; /* restart output on any character state */ 4957416Smarkm#ifdef DIAGNOSTICS 5057416Smarkmextern int diagnostic; /* telnet diagnostic capabilities */ 5157416Smarkm#endif /* DIAGNOSTICS */ 5257416Smarkmextern int require_otp; 5357416Smarkm#ifdef AUTHENTICATION 5457416Smarkmextern int auth_level; 5557416Smarkm#endif 5657416Smarkmextern const char *new_login; 5757416Smarkm 5857416Smarkmextern slcfun slctab[NSLC + 1]; /* slc mapping table */ 5957416Smarkm 60178825Sdfrextern char terminaltype[41]; 6157416Smarkm 6257416Smarkm/* 6357416Smarkm * I/O data buffers, pointers, and counters. 6457416Smarkm */ 6557416Smarkmextern char ptyobuf[BUFSIZ+NETSLOP], *pfrontp, *pbackp; 6657416Smarkm 6757416Smarkmextern char netibuf[BUFSIZ], *netip; 6857416Smarkm 6957416Smarkmextern char netobuf[BUFSIZ+NETSLOP], *nfrontp, *nbackp; 7057416Smarkmextern char *neturg; /* one past last bye of urgent data */ 7157416Smarkm 7257416Smarkmextern int pcc, ncc; 7357416Smarkm 7457416Smarkmextern int ourpty, net; 7557416Smarkmextern char *line; 7657416Smarkmextern int SYNCHing; /* we are in TELNET SYNCH mode */ 7757416Smarkm 7857416Smarkmint telnet_net_write (unsigned char *str, int len); 7957416Smarkmvoid net_encrypt (void); 8057416Smarkmint telnet_spin (void); 8172445Sassarchar *telnet_getenv (const char *val); 8257416Smarkmchar *telnet_gets (char *prompt, char *result, int length, int echo); 8357416Smarkmvoid get_slc_defaults (void); 8457416Smarkmvoid telrcv (void); 8557416Smarkmvoid send_do (int option, int init); 8657416Smarkmvoid willoption (int option); 8757416Smarkmvoid send_dont (int option, int init); 8857416Smarkmvoid wontoption (int option); 8957416Smarkmvoid send_will (int option, int init); 9057416Smarkmvoid dooption (int option); 9157416Smarkmvoid send_wont (int option, int init); 9257416Smarkmvoid dontoption (int option); 9357416Smarkmvoid suboption (void); 9457416Smarkmvoid doclientstat (void); 9557416Smarkmvoid send_status (void); 9657416Smarkmvoid init_termbuf (void); 9757416Smarkmvoid set_termbuf (void); 9857416Smarkmint spcset (int func, cc_t *valp, cc_t **valpp); 9957416Smarkmvoid set_utid (void); 10057416Smarkmint getpty (int *ptynum); 10157416Smarkmint tty_isecho (void); 10257416Smarkmint tty_flowmode (void); 10357416Smarkmint tty_restartany (void); 10457416Smarkmvoid tty_setecho (int on); 10557416Smarkmint tty_israw (void); 10657416Smarkmvoid tty_binaryin (int on); 10757416Smarkmvoid tty_binaryout (int on); 10857416Smarkmint tty_isbinaryin (void); 10957416Smarkmint tty_isbinaryout (void); 11057416Smarkmint tty_issofttab (void); 11157416Smarkmvoid tty_setsofttab (int on); 11257416Smarkmint tty_islitecho (void); 11357416Smarkmvoid tty_setlitecho (int on); 11457416Smarkmint tty_iscrnl (void); 11557416Smarkmvoid tty_tspeed (int val); 11657416Smarkmvoid tty_rspeed (int val); 11757416Smarkmvoid getptyslave (void); 118178825Sdfrint cleanopen (char *); 11978527Sassarvoid startslave (const char *host, const char *, int autologin, char *autoname); 12057416Smarkmvoid init_env (void); 12178527Sassarvoid start_login (const char *host, int autologin, char *name); 12257416Smarkmvoid cleanup (int sig); 12357416Smarkmint main (int argc, char **argv); 12457416Smarkmint getterminaltype (char *name, size_t); 12557416Smarkmvoid _gettermname (void); 12657416Smarkmint terminaltypeok (char *s); 12778527Sassarvoid my_telnet (int f, int p, const char*, const char *, int, char*); 12857416Smarkmvoid interrupt (void); 12957416Smarkmvoid sendbrk (void); 13057416Smarkmvoid sendsusp (void); 13157416Smarkmvoid recv_ayt (void); 13257416Smarkmvoid doeof (void); 13357416Smarkmvoid flowstat (void); 13457416Smarkmvoid clientstat (int code, int parm1, int parm2); 13557416Smarkmint ttloop (void); 13657416Smarkmint stilloob (int s); 13757416Smarkmvoid ptyflush (void); 13857416Smarkmchar *nextitem (char *current); 13957416Smarkmvoid netclear (void); 14057416Smarkmvoid netflush (void); 141178825Sdfrvoid writenet (const void *, size_t); 14257416Smarkmvoid fatal (int f, char *msg); 14357416Smarkmvoid fatalperror (int f, const char *msg); 14478527Sassarvoid fatalperror_errno (int f, const char *msg, int error); 14557416Smarkmvoid edithost (char *pat, char *host); 14657416Smarkmvoid putstr (char *s); 14757416Smarkmvoid putchr (int cc); 14857416Smarkmvoid putf (char *cp, char *where); 14957416Smarkmvoid printoption (char *fmt, int option); 150233294Sstasvoid printsub (int direction, unsigned char *pointer, size_t length); 151233294Sstasvoid printdata (char *tag, char *ptr, size_t cnt); 15257416Smarkmint login_tty(int t); 15357416Smarkm 15457416Smarkm#ifdef ENCRYPTION 15557416Smarkmextern void (*encrypt_output) (unsigned char *, int); 15657416Smarkmextern int (*decrypt_input) (int); 15757416Smarkmextern char *nclearto; 15857416Smarkm#endif 15957416Smarkm 16057416Smarkm 16157416Smarkm/* 16257416Smarkm * The following are some clocks used to decide how to interpret 16357416Smarkm * the relationship between various variables. 16457416Smarkm */ 16557416Smarkm 16657416Smarkmstruct clocks_t{ 16757416Smarkm int 16857416Smarkm system, /* what the current time is */ 16957416Smarkm echotoggle, /* last time user entered echo character */ 17057416Smarkm modenegotiated, /* last time operating mode negotiated */ 17157416Smarkm didnetreceive, /* last time we read data from network */ 17257416Smarkm ttypesubopt, /* ttype subopt is received */ 17357416Smarkm tspeedsubopt, /* tspeed subopt is received */ 17457416Smarkm environsubopt, /* environ subopt is received */ 17557416Smarkm oenvironsubopt, /* old environ subopt is received */ 17657416Smarkm xdisplocsubopt, /* xdisploc subopt is received */ 17757416Smarkm baseline, /* time started to do timed action */ 17857416Smarkm gotDM; /* when did we last see a data mark */ 17957416Smarkm}; 18057416Smarkmextern struct clocks_t clocks; 18157416Smarkm 18257416Smarkmextern int log_unauth; 18357416Smarkmextern int no_warn; 18457416Smarkm 18590926Snectarextern int def_tspeed, def_rspeed; 18690926Snectar#ifdef TIOCSWINSZ 18790926Snectarextern int def_row, def_col; 18890926Snectar#endif 18990926Snectar 19057416Smarkm#ifdef STREAMSPTY 19157416Smarkmextern int really_stream; 19257416Smarkm#endif 19357416Smarkm 19457416Smarkm#ifndef USE_IM 19557416Smarkm# ifdef CRAY 19657416Smarkm# define USE_IM "Cray UNICOS (%h) (%t)" 19757416Smarkm# endif 19857416Smarkm# ifdef _AIX 19957416Smarkm# define USE_IM "%s %v.%r (%h) (%t)" 20057416Smarkm# endif 20157416Smarkm# ifndef USE_IM 20257416Smarkm# define USE_IM "%s %r (%h) (%t)" 20357416Smarkm# endif 20457416Smarkm#endif 20557416Smarkm 20657416Smarkm#define DEFAULT_IM "\r\n\r\n" USE_IM "\r\n\r\n\r\n" 20757416Smarkm 20857416Smarkm#endif /* __EXT_H__ */ 209