xref: /illumos-gate/usr/src/cmd/ttymon/tmextern.h (revision dd72704bd9e794056c558153663c739e2012d721)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 /*
22  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
23  * Use is subject to license terms.
24  */
25 
26 /*	Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T	*/
27 /*	  All Rights Reserved	*/
28 
29 #ifndef	_TMEXTERN_H
30 #define	_TMEXTERN_H
31 
32 #include <stdio.h>
33 #include <unistd.h>
34 #include <sys/poll.h>
35 #include <sys/types.h>
36 #include <sys/stat.h>
37 #include <termio.h>
38 #include <sys/stermio.h>
39 #include <sys/termiox.h>
40 #include "tmstruct.h"
41 
42 #ifdef	__cplusplus
43 extern "C" {
44 #endif
45 
46 /* admutil.c	*/
47 	extern	int	find_label(FILE *, char *);
48 
49 /* sttytable.c	*/
50 	extern	const char *not_supported[];
51 
52 /* sttyparse.c	*/
53 #ifdef EUC
54 	extern	char	*sttyparse(int, char *[], int, struct termio *,
55 	    struct termios *, struct termiox *, struct winsize *,
56 	    eucwidth_t *, struct eucioc *, ldterm_cs_data_user_t *,
57 	    ldterm_cs_data_user_t *);
58 	extern	int	get_ttymode(int, struct termio *, struct termios *,
59 	    struct stio *, struct termiox *, struct winsize *,
60 	    struct eucioc *, ldterm_cs_data_user_t *);
61 	extern	int	set_ttymode(int, int, struct termio *, struct termios *,
62 	    struct stio *, struct termiox *, struct winsize *,
63 	    struct winsize *, struct eucioc *, ldterm_cs_data_user_t *, int);
64 #else
65 	extern	char	*sttyparse(int, char *[], int, struct termio *,
66 	    struct termios *, struct termiox *, struct winsize *);
67 	extern	int	get_ttymode(int, struct termio *, struct termios *,
68 	    struct stio *, struct termiox *, struct winsize *);
69 	extern	int	set_ttymode(int, int, struct termio *, struct termios *,
70 	    struct stio *, struct termiox *, struct winsize *,
71 	    struct winsize *);
72 #endif
73 
74 /* tmautobaud.c	*/
75 	extern	int	auto_termio(int);
76 	extern	char	*autobaud(int, int);
77 
78 /* tmchild.c	*/
79 	extern	void	write_prompt(int, struct pmtab *, int, int);
80 	extern	void	timedout(void);
81 	extern	void	tmchild(struct pmtab *);
82 	extern	void	sigpoll(int);
83 
84 /* tmexpress.c	*/
85 	extern	void	ttymon_express(int, char **);
86 	extern	void	revokedevaccess(char *, uid_t, gid_t, mode_t);
87 
88 /* tmhandler.c	*/
89 	extern	void	do_poll(struct pollfd *, int);
90 	extern	void	sigalarm(int);
91 	extern	void	sigterm(int);
92 	extern	void	sigchild(int);
93 	extern	void	sigpoll_catch(int);
94 	extern	void	state_change(void);
95 	extern	void	re_read(void);
96 	extern	void	got_carrier(struct pmtab *);
97 
98 /* tmlock.c	*/
99 	extern	int	tm_checklock(int);
100 	extern	int	tm_lock(int);
101 	extern	int	check_session(int);
102 	extern	char	*lastname(char *);
103 
104 /* tmlog.c	*/
105 	extern	void	log(const char *, ...);
106 	extern	void	fatal(const char *, ...);
107 	extern	void	openttymonlog(void);
108 
109 /* tmparse.c	*/
110 	extern	char	*getword(char *, int *, int);
111 	extern	char	quoted(char *, int *);
112 
113 /* tmpeek.c	*/
114 	extern	int	poll_data(void);
115 	extern	void	sigint(int);
116 
117 /* tmpmtab.c	*/
118 	extern	void	read_pmtab(void);
119 	extern	void	purge(void);
120 
121 /* tmsac.c	*/
122 	extern	void	openpid(void);
123 	extern	void	openpipes(void);
124 	extern	void	get_environ(void);
125 	extern	void	sacpoll(void);
126 
127 /* tmsig.c	*/
128 	extern	void catch_signals(void);
129 	extern	void child_sigcatch(void);
130 
131 /* tmterm.c	*/
132 	extern  int	push_linedisc(int, char *, char *);
133 	extern	int	set_termio(int, char *, char *, int, long);
134 	extern	int	initial_termio(int, struct pmtab *);
135 	extern	int	hang_up_line(int);
136 	extern	void	flush_input(int);
137 
138 /* tmttydefs.c	*/
139 	extern	void	read_ttydefs(const char *, int);
140 	extern	struct	Gdef *find_def(char *);
141 	extern	void	mkargv(char *, char **, int *, int);
142 	extern	int	check_flags(char *);
143 	extern	char	*strsave(char *);
144 
145 /* tmutmp.c	*/
146 	extern	int	account(char *);
147 	extern	void	cleanut(pid_t, int);
148 	extern	int	checkut_line(char *line);
149 	extern	void	getty_account(char *);
150 
151 /* tmutil.c	*/
152 	extern	int	check_device(char *);
153 	extern	int	check_cmd(char *);
154 	extern	void	cons_printf(const char *, ...);
155 	extern	void	copystr(char *, char *);
156 	extern	int	strcheck(char *, int);
157 	extern	int	vml(char *);
158 
159 /* misc sys call or lib function call */
160 	extern	int	check_version(int, char *);
161 
162 #ifdef	SYS_NAME
163 	extern	void sys_name(int);
164 #endif
165 
166 
167 /* tmglobal.c	*/
168 	extern	struct	Gdef DEFAULT;
169 	extern	int	Retry;
170 	extern	struct	rlimit Rlimit;
171 	extern	struct	pmtab	*PMtab;
172 	extern	struct	pollfd	*Pollp;
173 	extern	int	Nentries;
174 
175 	extern	int	Npollfd;
176 
177 	extern	struct	Gdef Gdef[];
178 	extern	int	Ndefs;
179 	extern	long	Mtime;
180 
181 	extern	FILE	*Logfp;
182 	extern	int	Sfd, Pfd;
183 	extern	int	PCpipe[];
184 	extern	int	Lckfd;
185 
186 	extern	char	State;
187 	extern	char	*Istate;
188 	extern	char	*Tag;
189 	extern	int	Reread_flag;
190 
191 	extern	int	Maxfiles;
192 	extern	int	Maxfds;
193 
194 	extern	char	**environ;
195 	extern	char	*optarg;
196 	extern	int	optind, opterr;
197 
198 	extern	int	Nlocked;
199 
200 	extern	sigset_t	Origmask;
201 	extern	struct	sigaction	Sigalrm;	/* SIGALRM */
202 	extern	struct	sigaction	Sigcld;		/* SIGCLD */
203 	extern	struct	sigaction	Sigint;		/* SIGINT */
204 	extern	struct	sigaction	Sigpoll;	/* SIGPOLL */
205 	extern	struct	sigaction	Sigquit;	/* SIGQUIT */
206 	extern	struct	sigaction	Sigterm;	/* SIGTERM */
207 #ifdef	DEBUG
208 	extern	struct	sigaction	Sigusr1;	/* SIGUSR1 */
209 	extern	struct	sigaction	Sigusr2;	/* SIGUSR2 */
210 #endif
211 
212 #ifdef	DEBUG
213 	extern	FILE	*Debugfp;
214 	extern	void	debug(const char *, ...);
215 #endif
216 
217 	extern	uid_t	Uucp_uid;
218 	extern	gid_t	Tty_gid;
219 	extern	struct	strbuf *peek_ptr;
220 
221 	extern	int	Logmaxsz;
222 	extern	int	Splflag;
223 
224 /* ttymon.c	*/
225 	extern	struct	Gdef *get_speed(struct pmtab *);
226 	extern	void	open_device(struct pmtab *);
227 	extern	void	set_softcar(struct pmtab *);
228 	extern	void	setup_PCpipe(void);
229 
230 /* ulockf.c	*/
231 	extern	int	fd_cklock(int);
232 	extern	int	fd_mklock(int);
233 
234 #ifdef	__cplusplus
235 }
236 #endif
237 
238 #endif	/* _TMEXTERN_H */
239