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