Path: blob/main/crypto/heimdal/appl/telnet/telnetd/ext.h
34879 views
/*1* Copyright (c) 1989, 19932* The Regents of the University of California. All rights reserved.3*4* Redistribution and use in source and binary forms, with or without5* modification, are permitted provided that the following conditions6* are met:7* 1. Redistributions of source code must retain the above copyright8* notice, this list of conditions and the following disclaimer.9* 2. Redistributions in binary form must reproduce the above copyright10* notice, this list of conditions and the following disclaimer in the11* documentation and/or other materials provided with the distribution.12* 3. All advertising materials mentioning features or use of this software13* must display the following acknowledgement:14* This product includes software developed by the University of15* California, Berkeley and its contributors.16* 4. Neither the name of the University nor the names of its contributors17* may be used to endorse or promote products derived from this software18* without specific prior written permission.19*20* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND21* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE22* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE23* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE24* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL25* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS26* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)27* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT28* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY29* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF30* SUCH DAMAGE.31*32* @(#)ext.h 8.2 (Berkeley) 12/15/9333*/3435/* $Id$ */3637#ifndef __EXT_H__38#define __EXT_H__3940/*41* Telnet server variable declarations42*/43extern char options[256];44extern char do_dont_resp[256];45extern char will_wont_resp[256];46extern int flowmode; /* current flow control state */47extern int restartany; /* restart output on any character state */48#ifdef DIAGNOSTICS49extern int diagnostic; /* telnet diagnostic capabilities */50#endif /* DIAGNOSTICS */51extern int require_otp;52#ifdef AUTHENTICATION53extern int auth_level;54#endif55extern const char *new_login;5657extern slcfun slctab[NSLC + 1]; /* slc mapping table */5859extern char terminaltype[41];6061/*62* I/O data buffers, pointers, and counters.63*/64extern char ptyobuf[BUFSIZ+NETSLOP], *pfrontp, *pbackp;6566extern char netibuf[BUFSIZ], *netip;6768extern char netobuf[BUFSIZ+NETSLOP], *nfrontp, *nbackp;69extern char *neturg; /* one past last bye of urgent data */7071extern int pcc, ncc;7273extern int ourpty, net;74extern char *line;75extern int SYNCHing; /* we are in TELNET SYNCH mode */7677int telnet_net_write (unsigned char *str, int len);78void net_encrypt (void);79int telnet_spin (void);80char *telnet_getenv (const char *val);81char *telnet_gets (char *prompt, char *result, int length, int echo);82void get_slc_defaults (void);83void telrcv (void);84void send_do (int option, int init);85void willoption (int option);86void send_dont (int option, int init);87void wontoption (int option);88void send_will (int option, int init);89void dooption (int option);90void send_wont (int option, int init);91void dontoption (int option);92void suboption (void);93void doclientstat (void);94void send_status (void);95void init_termbuf (void);96void set_termbuf (void);97int spcset (int func, cc_t *valp, cc_t **valpp);98void set_utid (void);99int getpty (int *ptynum);100int tty_isecho (void);101int tty_flowmode (void);102int tty_restartany (void);103void tty_setecho (int on);104int tty_israw (void);105void tty_binaryin (int on);106void tty_binaryout (int on);107int tty_isbinaryin (void);108int tty_isbinaryout (void);109int tty_issofttab (void);110void tty_setsofttab (int on);111int tty_islitecho (void);112void tty_setlitecho (int on);113int tty_iscrnl (void);114void tty_tspeed (int val);115void tty_rspeed (int val);116void getptyslave (void);117int cleanopen (char *);118void startslave (const char *host, const char *, int autologin, char *autoname);119void init_env (void);120void start_login (const char *host, int autologin, char *name);121void cleanup (int sig);122int main (int argc, char **argv);123int getterminaltype (char *name, size_t);124void _gettermname (void);125int terminaltypeok (char *s);126void my_telnet (int f, int p, const char*, const char *, int, char*);127void interrupt (void);128void sendbrk (void);129void sendsusp (void);130void recv_ayt (void);131void doeof (void);132void flowstat (void);133void clientstat (int code, int parm1, int parm2);134int ttloop (void);135int stilloob (int s);136void ptyflush (void);137char *nextitem (char *current);138void netclear (void);139void netflush (void);140void writenet (const void *, size_t);141void fatal (int f, char *msg);142void fatalperror (int f, const char *msg);143void fatalperror_errno (int f, const char *msg, int error);144void edithost (char *pat, char *host);145void putstr (char *s);146void putchr (int cc);147void putf (char *cp, char *where);148void printoption (char *fmt, int option);149void printsub (int direction, unsigned char *pointer, size_t length);150void printdata (char *tag, char *ptr, size_t cnt);151int login_tty(int t);152153#ifdef ENCRYPTION154extern void (*encrypt_output) (unsigned char *, int);155extern int (*decrypt_input) (int);156extern char *nclearto;157#endif158159160/*161* The following are some clocks used to decide how to interpret162* the relationship between various variables.163*/164165struct clocks_t{166int167system, /* what the current time is */168echotoggle, /* last time user entered echo character */169modenegotiated, /* last time operating mode negotiated */170didnetreceive, /* last time we read data from network */171ttypesubopt, /* ttype subopt is received */172tspeedsubopt, /* tspeed subopt is received */173environsubopt, /* environ subopt is received */174oenvironsubopt, /* old environ subopt is received */175xdisplocsubopt, /* xdisploc subopt is received */176baseline, /* time started to do timed action */177gotDM; /* when did we last see a data mark */178};179extern struct clocks_t clocks;180181extern int log_unauth;182extern int no_warn;183184extern int def_tspeed, def_rspeed;185#ifdef TIOCSWINSZ186extern int def_row, def_col;187#endif188189#ifdef STREAMSPTY190extern int really_stream;191#endif192193#ifndef USE_IM194# ifdef CRAY195# define USE_IM "Cray UNICOS (%h) (%t)"196# endif197# ifdef _AIX198# define USE_IM "%s %v.%r (%h) (%t)"199# endif200# ifndef USE_IM201# define USE_IM "%s %r (%h) (%t)"202# endif203#endif204205#define DEFAULT_IM "\r\n\r\n" USE_IM "\r\n\r\n\r\n"206207#endif /* __EXT_H__ */208209210