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