Revert "libtelnet/telnetd(8): Fix building with -fno-common."
[dragonfly.git] / libexec / telnetd / ext.h
CommitLineData
984263bc
MD
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.
0f0f9bbd 13 * 3. Neither the name of the University nor the names of its contributors
984263bc
MD
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
068e7061 30 * $FreeBSD: src/crypto/telnet/telnetd/ext.h,v 1.2.8.4 2002/04/13 10:59:08 markm Exp $
984263bc
MD
31 */
32
33/*
34 * Telnet server variable declarations
35 */
36extern char options[256];
37extern char do_dont_resp[256];
38extern char will_wont_resp[256];
39extern int linemode; /* linemode on/off */
40#ifdef LINEMODE
41extern int uselinemode; /* what linemode to use (on/off) */
42extern int editmode; /* edit modes in use */
43extern int useeditmode; /* edit modes to use */
44extern int alwayslinemode; /* command line option */
45extern int lmodetype; /* Client support for linemode */
46#endif /* LINEMODE */
47extern int flowmode; /* current flow control state */
48extern int restartany; /* restart output on any character state */
49#ifdef DIAGNOSTICS
50extern int diagnostic; /* telnet diagnostic capabilities */
51#endif /* DIAGNOSTICS */
52#ifdef BFTPDAEMON
53extern int bftpd; /* behave as bftp daemon */
54#endif /* BFTPDAEMON */
068e7061
PA
55#ifdef AUTHENTICATION
56extern int auth_level;
57#endif
984263bc
MD
58
59extern slcfun slctab[NSLC + 1]; /* slc mapping table */
60
068e7061
PA
61#define TERMINAL_TYPE_SIZE 41 /* allocated space for terminaltype */
62
1c6ee455 63char *terminaltype;
984263bc
MD
64
65/*
66 * I/O data buffers, pointers, and counters.
67 */
68extern char ptyobuf[BUFSIZ+NETSLOP], *pfrontp, *pbackp;
69
70extern char netibuf[BUFSIZ], *netip;
71
72extern char netobuf[BUFSIZ], *nfrontp, *nbackp;
73extern char *neturg; /* one past last bye of urgent data */
74
75extern int pcc, ncc;
76
77extern int pty, net;
78extern char line[16];
79extern int SYNCHing; /* we are in TELNET SYNCH mode */
80
81extern void
82 _termstat(void),
83 add_slc(char, char, cc_t),
84 check_slc(void),
85 change_slc(char, char, cc_t),
b9c8dce8 86 cleanup(int) __dead2,
984263bc
MD
87 clientstat(int, int, int),
88 copy_termbuf(char *, size_t),
89 deferslc(void),
90 defer_terminit(void),
91 do_opt_slc(unsigned char *, int),
92 doeof(void),
93 dooption(int),
94 dontoption(int),
95 edithost(char *, char *),
ccf9d6e5 96 fatalmsg(int, const char *) __dead2,
b9c8dce8 97 fatalperror(int, const char *) __dead2,
984263bc
MD
98 get_slc_defaults(void),
99 init_env(void),
100 init_termbuf(void),
101 interrupt(void),
102 localstat(void),
103 flowstat(void),
104 netclear(void),
105 netflush(void),
106#ifdef DIAGNOSTICS
107 printoption(const char *, int),
108 printdata(const char *, char *, int),
109 printsub(char, unsigned char *, int),
110#endif
111 process_slc(unsigned char, unsigned char, cc_t),
112 ptyflush(void),
113 putchr(int),
114 putf(char *, char *),
115 recv_ayt(void),
116 send_do(int, int),
117 send_dont(int, int),
118 send_slc(void),
119 send_status(void),
120 send_will(int, int),
121 send_wont(int, int),
122 sendbrk(void),
123 sendsusp(void),
124 set_termbuf(void),
b9c8dce8 125 start_login(char *, int, char *) __dead2,
984263bc 126 start_slc(int),
068e7061
PA
127#ifdef AUTHENTICATION
128 start_slave(char *),
129#else
984263bc 130 start_slave(char *, int, char *),
068e7061 131#endif
984263bc
MD
132 suboption(void),
133 telrcv(void),
134 ttloop(void),
135 tty_binaryin(int),
136 tty_binaryout(int);
137
138extern int
139 end_slc(unsigned char **),
140 getnpty(void),
141#ifndef convex
142 getpty(int *),
143#endif
144 login_tty(int),
145 spcset(int, cc_t *, cc_t **),
146 stilloob(int),
147 terminit(void),
148 termstat(void),
149 tty_flowmode(void),
150 tty_restartany(void),
151 tty_isbinaryin(void),
152 tty_isbinaryout(void),
153 tty_iscrnl(void),
154 tty_isecho(void),
155 tty_isediting(void),
156 tty_islitecho(void),
157 tty_isnewmap(void),
158 tty_israw(void),
159 tty_issofttab(void),
160 tty_istrapsig(void),
161 tty_linemode(void);
162
163extern void
164 tty_rspeed(int),
165 tty_setecho(int),
166 tty_setedit(int),
167 tty_setlinemode(int),
168 tty_setlitecho(int),
169 tty_setsig(int),
170 tty_setsofttab(int),
171 tty_tspeed(int),
172 willoption(int),
173 wontoption(int);
174
175int output_data(const char *, ...) __printflike(1, 2);
176void output_datalen(const char *, int);
177void startslave(char *, int, char *);
178
068e7061
PA
179#ifdef ENCRYPTION
180extern void (*encrypt_output)(unsigned char *, int);
181extern int (*decrypt_input)(int);
182extern char *nclearto;
183#endif /* ENCRYPTION */
984263bc
MD
184
185
186/*
187 * The following are some clocks used to decide how to interpret
188 * the relationship between various variables.
189 */
190
191extern struct {
192 int
193 system, /* what the current time is */
194 echotoggle, /* last time user entered echo character */
195 modenegotiated, /* last time operating mode negotiated */
196 didnetreceive, /* last time we read data from network */
197 ttypesubopt, /* ttype subopt is received */
198 tspeedsubopt, /* tspeed subopt is received */
199 environsubopt, /* environ subopt is received */
200 oenvironsubopt, /* old environ subopt is received */
201 xdisplocsubopt, /* xdisploc subopt is received */
202 baseline, /* time started to do timed action */
203 gotDM; /* when did we last see a data mark */
204} clocks;
205
206#ifndef DEFAULT_IM
207# ifdef ultrix
208# define DEFAULT_IM "\r\n\r\nULTRIX (%h) (%t)\r\n\r\r\n\r"
209# else
3e182402
MD
210# if defined(__DragonFly__)
211# define DEFAULT_IM "\r\n\r\nDragonFly (%h) (%t)\r\n\r\r\n\r"
212# elif defined(__FreeBSD__)
984263bc
MD
213# define DEFAULT_IM "\r\n\r\nFreeBSD (%h) (%t)\r\n\r\r\n\r"
214# else
215# define DEFAULT_IM "\r\n\r\n4.4 BSD UNIX (%h) (%t)\r\n\r\r\n\r"
216# endif
217# endif
218#endif