Merge from vendor branch BZIP:
[dragonfly.git] / crypto / telnet / telnetd / ext.h
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. All advertising materials mentioning features or use of this software
14  *    must display the following acknowledgement:
15  *      This product includes software developed by the University of
16  *      California, Berkeley and its contributors.
17  * 4. Neither the name of the University nor the names of its contributors
18  *    may be used to endorse or promote products derived from this software
19  *    without specific prior written permission.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
22  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
25  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31  * SUCH DAMAGE.
32  *
33  *      @(#)ext.h       8.2 (Berkeley) 12/15/93
34  * $FreeBSD: src/crypto/telnet/telnetd/ext.h,v 1.2.8.4 2002/04/13 10:59:08 markm Exp $
35  * $DragonFly: src/crypto/telnet/telnetd/ext.h,v 1.2 2003/06/17 04:24:37 dillon Exp $
36  */
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      linemode;       /* linemode on/off */
45 #ifdef  LINEMODE
46 extern int      uselinemode;    /* what linemode to use (on/off) */
47 extern int      editmode;       /* edit modes in use */
48 extern int      useeditmode;    /* edit modes to use */
49 extern int      alwayslinemode; /* command line option */
50 extern int      lmodetype;      /* Client support for linemode */
51 #endif  /* LINEMODE */
52 extern int      flowmode;       /* current flow control state */
53 extern int      restartany;     /* restart output on any character state */
54 #ifdef DIAGNOSTICS
55 extern int      diagnostic;     /* telnet diagnostic capabilities */
56 #endif /* DIAGNOSTICS */
57 #ifdef BFTPDAEMON
58 extern int      bftpd;          /* behave as bftp daemon */
59 #endif /* BFTPDAEMON */
60 #ifdef  AUTHENTICATION
61 extern int      auth_level;
62 #endif
63
64 extern slcfun   slctab[NSLC + 1];       /* slc mapping table */
65
66 char    *terminaltype;
67
68 /*
69  * I/O data buffers, pointers, and counters.
70  */
71 extern char     ptyobuf[BUFSIZ+NETSLOP], *pfrontp, *pbackp;
72
73 extern char     netibuf[BUFSIZ], *netip;
74
75 extern char     netobuf[BUFSIZ], *nfrontp, *nbackp;
76 extern char     *neturg;                /* one past last bye of urgent data */
77
78 extern int      pcc, ncc;
79
80 extern int      pty, net;
81 extern char     line[16];
82 extern int      SYNCHing;               /* we are in TELNET SYNCH mode */
83
84 extern void
85         _termstat(void),
86         add_slc(char, char, cc_t),
87         check_slc(void),
88         change_slc(char, char, cc_t),
89         cleanup(int),
90         clientstat(int, int, int),
91         copy_termbuf(char *, size_t),
92         deferslc(void),
93         defer_terminit(void),
94         do_opt_slc(unsigned char *, int),
95         doeof(void),
96         dooption(int),
97         dontoption(int),
98         edithost(char *, char *),
99         fatal(int, const char *),
100         fatalperror(int, const char *),
101         get_slc_defaults(void),
102         init_env(void),
103         init_termbuf(void),
104         interrupt(void),
105         localstat(void),
106         flowstat(void),
107         netclear(void),
108         netflush(void),
109 #ifdef DIAGNOSTICS
110         printoption(const char *, int),
111         printdata(const char *, char *, int),
112         printsub(char, unsigned char *, int),
113 #endif
114         process_slc(unsigned char, unsigned char, cc_t),
115         ptyflush(void),
116         putchr(int),
117         putf(char *, char *),
118         recv_ayt(void),
119         send_do(int, int),
120         send_dont(int, int),
121         send_slc(void),
122         send_status(void),
123         send_will(int, int),
124         send_wont(int, int),
125         sendbrk(void),
126         sendsusp(void),
127         set_termbuf(void),
128         start_login(char *, int, char *),
129         start_slc(int),
130 #ifdef  AUTHENTICATION
131         start_slave(char *),
132 #else
133         start_slave(char *, int, char *),
134 #endif
135         suboption(void),
136         telrcv(void),
137         ttloop(void),
138         tty_binaryin(int),
139         tty_binaryout(int);
140
141 extern int
142         end_slc(unsigned char **),
143         getnpty(void),
144 #ifndef convex
145         getpty(int *),
146 #endif
147         login_tty(int),
148         spcset(int, cc_t *, cc_t **),
149         stilloob(int),
150         terminit(void),
151         termstat(void),
152         tty_flowmode(void),
153         tty_restartany(void),
154         tty_isbinaryin(void),
155         tty_isbinaryout(void),
156         tty_iscrnl(void),
157         tty_isecho(void),
158         tty_isediting(void),
159         tty_islitecho(void),
160         tty_isnewmap(void),
161         tty_israw(void),
162         tty_issofttab(void),
163         tty_istrapsig(void),
164         tty_linemode(void);
165
166 extern void
167         tty_rspeed(int),
168         tty_setecho(int),
169         tty_setedit(int),
170         tty_setlinemode(int),
171         tty_setlitecho(int),
172         tty_setsig(int),
173         tty_setsofttab(int),
174         tty_tspeed(int),
175         willoption(int),
176         wontoption(int);
177
178 int     output_data(const char *, ...) __printflike(1, 2);
179 void    output_datalen(const char *, int);
180 void    startslave(char *, int, char *);
181
182 #ifdef  ENCRYPTION
183 extern void     (*encrypt_output)(unsigned char *, int);
184 extern int      (*decrypt_input)(int);
185 extern char     *nclearto;
186 #endif  /* ENCRYPTION */
187
188
189 /*
190  * The following are some clocks used to decide how to interpret
191  * the relationship between various variables.
192  */
193
194 extern struct {
195     int
196         system,                 /* what the current time is */
197         echotoggle,             /* last time user entered echo character */
198         modenegotiated,         /* last time operating mode negotiated */
199         didnetreceive,          /* last time we read data from network */
200         ttypesubopt,            /* ttype subopt is received */
201         tspeedsubopt,           /* tspeed subopt is received */
202         environsubopt,          /* environ subopt is received */
203         oenvironsubopt,         /* old environ subopt is received */
204         xdisplocsubopt,         /* xdisploc subopt is received */
205         baseline,               /* time started to do timed action */
206         gotDM;                  /* when did we last see a data mark */
207 } clocks;
208
209 #ifndef DEFAULT_IM
210 #   ifdef ultrix
211 #    define DEFAULT_IM  "\r\n\r\nULTRIX (%h) (%t)\r\n\r\r\n\r"
212 #   else
213 #    ifdef __FreeBSD__
214 #     define DEFAULT_IM  "\r\n\r\nFreeBSD (%h) (%t)\r\n\r\r\n\r"
215 #    else
216 #    define DEFAULT_IM  "\r\n\r\n4.4 BSD UNIX (%h) (%t)\r\n\r\r\n\r"
217 #    endif
218 #   endif
219 #endif