xref: /illumos-gate/usr/src/cmd/ttymon/tmextern.h (revision 306990466301759c88d84c51c57b57ca930a3635)
17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * CDDL HEADER START
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5b77c815bSNobutomo Nakano  * Common Development and Distribution License (the "License").
6b77c815bSNobutomo Nakano  * You may not use this file except in compliance with the License.
77c478bd9Sstevel@tonic-gate  *
87c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
107c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
117c478bd9Sstevel@tonic-gate  * and limitations under the License.
127c478bd9Sstevel@tonic-gate  *
137c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
147c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
167c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
177c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
187c478bd9Sstevel@tonic-gate  *
197c478bd9Sstevel@tonic-gate  * CDDL HEADER END
207c478bd9Sstevel@tonic-gate  */
217c478bd9Sstevel@tonic-gate /*
22b77c815bSNobutomo Nakano  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
237c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
247c478bd9Sstevel@tonic-gate  */
257c478bd9Sstevel@tonic-gate 
267c478bd9Sstevel@tonic-gate /*	Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T	*/
277c478bd9Sstevel@tonic-gate /*	  All Rights Reserved	*/
287c478bd9Sstevel@tonic-gate 
29d67944fbSScott Rotondo #ifndef	_TMEXTERN_H
30d67944fbSScott Rotondo #define	_TMEXTERN_H
317c478bd9Sstevel@tonic-gate 
323bb2c156SToomas Soome #include <stdio.h>
333bb2c156SToomas Soome #include <unistd.h>
343bb2c156SToomas Soome #include <sys/poll.h>
353bb2c156SToomas Soome #include <sys/types.h>
363bb2c156SToomas Soome #include <sys/stat.h>
373bb2c156SToomas Soome #include <termio.h>
383bb2c156SToomas Soome #include <sys/stermio.h>
393bb2c156SToomas Soome #include <sys/termiox.h>
40d67944fbSScott Rotondo #include "tmstruct.h"
417c478bd9Sstevel@tonic-gate 
427c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
437c478bd9Sstevel@tonic-gate extern "C" {
447c478bd9Sstevel@tonic-gate #endif
457c478bd9Sstevel@tonic-gate 
463bb2c156SToomas Soome /* admutil.c	*/
473bb2c156SToomas Soome 	extern	int	find_label(FILE *, char *);
483bb2c156SToomas Soome 
493bb2c156SToomas Soome /* sttytable.c	*/
503bb2c156SToomas Soome 	extern	const char *not_supported[];
513bb2c156SToomas Soome 
523bb2c156SToomas Soome /* sttyparse.c	*/
533bb2c156SToomas Soome #ifdef EUC
543bb2c156SToomas Soome 	extern	char	*sttyparse(int, char *[], int, struct termio *,
553bb2c156SToomas Soome 	    struct termios *, struct termiox *, struct winsize *,
563bb2c156SToomas Soome 	    eucwidth_t *, struct eucioc *, ldterm_cs_data_user_t *,
573bb2c156SToomas Soome 	    ldterm_cs_data_user_t *);
583bb2c156SToomas Soome 	extern	int	get_ttymode(int, struct termio *, struct termios *,
593bb2c156SToomas Soome 	    struct stio *, struct termiox *, struct winsize *,
603bb2c156SToomas Soome 	    struct eucioc *, ldterm_cs_data_user_t *);
613bb2c156SToomas Soome 	extern	int	set_ttymode(int, int, struct termio *, struct termios *,
623bb2c156SToomas Soome 	    struct stio *, struct termiox *, struct winsize *,
633bb2c156SToomas Soome 	    struct winsize *, struct eucioc *, ldterm_cs_data_user_t *, int);
643bb2c156SToomas Soome #else
653bb2c156SToomas Soome 	extern	char	*sttyparse(int, char *[], int, struct termio *,
663bb2c156SToomas Soome 	    struct termios *, struct termiox *, struct winsize *);
673bb2c156SToomas Soome 	extern	int	get_ttymode(int, struct termio *, struct termios *,
683bb2c156SToomas Soome 	    struct stio *, struct termiox *, struct winsize *);
693bb2c156SToomas Soome 	extern	int	set_ttymode(int, int, struct termio *, struct termios *,
703bb2c156SToomas Soome 	    struct stio *, struct termiox *, struct winsize *,
713bb2c156SToomas Soome 	    struct winsize *);
723bb2c156SToomas Soome #endif
737c478bd9Sstevel@tonic-gate 
747c478bd9Sstevel@tonic-gate /* tmautobaud.c	*/
753bb2c156SToomas Soome 	extern	int	auto_termio(int);
763bb2c156SToomas Soome 	extern	char	*autobaud(int, int);
777c478bd9Sstevel@tonic-gate 
787c478bd9Sstevel@tonic-gate /* tmchild.c	*/
793bb2c156SToomas Soome 	extern	void	write_prompt(int, struct pmtab *, int, int);
80*30699046SRichard Lowe 	extern	void	timedout(int);
813bb2c156SToomas Soome 	extern	void	tmchild(struct pmtab *);
823bb2c156SToomas Soome 	extern	void	sigpoll(int);
837c478bd9Sstevel@tonic-gate 
847c478bd9Sstevel@tonic-gate /* tmexpress.c	*/
853bb2c156SToomas Soome 	extern	void	ttymon_express(int, char **);
863bb2c156SToomas Soome 	extern	void	revokedevaccess(char *, uid_t, gid_t, mode_t);
877c478bd9Sstevel@tonic-gate 
887c478bd9Sstevel@tonic-gate /* tmhandler.c	*/
893bb2c156SToomas Soome 	extern	void	do_poll(struct pollfd *, int);
903bb2c156SToomas Soome 	extern	void	sigalarm(int);
913bb2c156SToomas Soome 	extern	void	sigterm(int);
923bb2c156SToomas Soome 	extern	void	sigchild(int);
933bb2c156SToomas Soome 	extern	void	sigpoll_catch(int);
943bb2c156SToomas Soome 	extern	void	state_change(void);
953bb2c156SToomas Soome 	extern	void	re_read(void);
963bb2c156SToomas Soome 	extern	void	got_carrier(struct pmtab *);
977c478bd9Sstevel@tonic-gate 
987c478bd9Sstevel@tonic-gate /* tmlock.c	*/
993bb2c156SToomas Soome 	extern	int	tm_checklock(int);
1003bb2c156SToomas Soome 	extern	int	tm_lock(int);
1013bb2c156SToomas Soome 	extern	int	check_session(int);
1023bb2c156SToomas Soome 	extern	char	*lastname(char *);
1037c478bd9Sstevel@tonic-gate 
1047c478bd9Sstevel@tonic-gate /* tmlog.c	*/
1057c478bd9Sstevel@tonic-gate 	extern	void	log(const char *, ...);
1067c478bd9Sstevel@tonic-gate 	extern	void	fatal(const char *, ...);
1077c478bd9Sstevel@tonic-gate 	extern	void	openttymonlog(void);
1087c478bd9Sstevel@tonic-gate 
1097c478bd9Sstevel@tonic-gate /* tmparse.c	*/
1103bb2c156SToomas Soome 	extern	char	*getword(char *, int *, int);
1113bb2c156SToomas Soome 	extern	char	quoted(char *, int *);
1127c478bd9Sstevel@tonic-gate 
1137c478bd9Sstevel@tonic-gate /* tmpeek.c	*/
1143bb2c156SToomas Soome 	extern	int	poll_data(void);
1153bb2c156SToomas Soome 	extern	void	sigint(int);
1167c478bd9Sstevel@tonic-gate 
1177c478bd9Sstevel@tonic-gate /* tmpmtab.c	*/
1183bb2c156SToomas Soome 	extern	void	read_pmtab(void);
1193bb2c156SToomas Soome 	extern	void	purge(void);
1207c478bd9Sstevel@tonic-gate 
1217c478bd9Sstevel@tonic-gate /* tmsac.c	*/
1223bb2c156SToomas Soome 	extern	void	openpid(void);
1233bb2c156SToomas Soome 	extern	void	openpipes(void);
1243bb2c156SToomas Soome 	extern	void	get_environ(void);
1253bb2c156SToomas Soome 	extern	void	sacpoll(void);
1267c478bd9Sstevel@tonic-gate 
1277c478bd9Sstevel@tonic-gate /* tmsig.c	*/
1283bb2c156SToomas Soome 	extern	void catch_signals(void);
1293bb2c156SToomas Soome 	extern	void child_sigcatch(void);
1307c478bd9Sstevel@tonic-gate 
1317c478bd9Sstevel@tonic-gate /* tmterm.c	*/
1323bb2c156SToomas Soome 	extern  int	push_linedisc(int, char *, char *);
1333bb2c156SToomas Soome 	extern	int	set_termio(int, char *, char *, int, long);
1343bb2c156SToomas Soome 	extern	int	initial_termio(int, struct pmtab *);
1353bb2c156SToomas Soome 	extern	int	hang_up_line(int);
1363bb2c156SToomas Soome 	extern	void	flush_input(int);
1377c478bd9Sstevel@tonic-gate 
1387c478bd9Sstevel@tonic-gate /* tmttydefs.c	*/
1393bb2c156SToomas Soome 	extern	void	read_ttydefs(const char *, int);
1403bb2c156SToomas Soome 	extern	struct	Gdef *find_def(char *);
1413bb2c156SToomas Soome 	extern	void	mkargv(char *, char **, int *, int);
1423bb2c156SToomas Soome 	extern	int	check_flags(char *);
1433bb2c156SToomas Soome 	extern	char	*strsave(char *);
1447c478bd9Sstevel@tonic-gate 
1457c478bd9Sstevel@tonic-gate /* tmutmp.c	*/
1463bb2c156SToomas Soome 	extern	int	account(char *);
1473bb2c156SToomas Soome 	extern	void	cleanut(pid_t, int);
1483bb2c156SToomas Soome 	extern	int	checkut_line(char *line);
1493bb2c156SToomas Soome 	extern	void	getty_account(char *);
1507c478bd9Sstevel@tonic-gate 
1517c478bd9Sstevel@tonic-gate /* tmutil.c	*/
1523bb2c156SToomas Soome 	extern	int	check_device(char *);
1533bb2c156SToomas Soome 	extern	int	check_cmd(char *);
1547c478bd9Sstevel@tonic-gate 	extern	void	cons_printf(const char *, ...);
1553bb2c156SToomas Soome 	extern	void	copystr(char *, char *);
1563bb2c156SToomas Soome 	extern	int	strcheck(char *, int);
1573bb2c156SToomas Soome 	extern	int	vml(char *);
1587c478bd9Sstevel@tonic-gate 
1597c478bd9Sstevel@tonic-gate /* misc sys call or lib function call */
1603bb2c156SToomas Soome 	extern	int	check_version(int, char *);
1617c478bd9Sstevel@tonic-gate 
1627c478bd9Sstevel@tonic-gate #ifdef	SYS_NAME
1633bb2c156SToomas Soome 	extern	void sys_name(int);
1647c478bd9Sstevel@tonic-gate #endif
1657c478bd9Sstevel@tonic-gate 
1667c478bd9Sstevel@tonic-gate 
1677c478bd9Sstevel@tonic-gate /* tmglobal.c	*/
1683bb2c156SToomas Soome 	extern	struct	Gdef DEFAULT;
1693bb2c156SToomas Soome 	extern	int	Retry;
1703bb2c156SToomas Soome 	extern	struct	rlimit Rlimit;
1717c478bd9Sstevel@tonic-gate 	extern	struct	pmtab	*PMtab;
1723bb2c156SToomas Soome 	extern	struct	pollfd	*Pollp;
1737c478bd9Sstevel@tonic-gate 	extern	int	Nentries;
1747c478bd9Sstevel@tonic-gate 
1757c478bd9Sstevel@tonic-gate 	extern	int	Npollfd;
1767c478bd9Sstevel@tonic-gate 
1777c478bd9Sstevel@tonic-gate 	extern	struct	Gdef Gdef[];
1787c478bd9Sstevel@tonic-gate 	extern	int	Ndefs;
1797c478bd9Sstevel@tonic-gate 	extern	long	Mtime;
1807c478bd9Sstevel@tonic-gate 
1817c478bd9Sstevel@tonic-gate 	extern	FILE	*Logfp;
1827c478bd9Sstevel@tonic-gate 	extern	int	Sfd, Pfd;
1837c478bd9Sstevel@tonic-gate 	extern	int	PCpipe[];
1847c478bd9Sstevel@tonic-gate 	extern	int	Lckfd;
1857c478bd9Sstevel@tonic-gate 
1867c478bd9Sstevel@tonic-gate 	extern	char	State;
1877c478bd9Sstevel@tonic-gate 	extern	char	*Istate;
1887c478bd9Sstevel@tonic-gate 	extern	char	*Tag;
1897c478bd9Sstevel@tonic-gate 	extern	int	Reread_flag;
1907c478bd9Sstevel@tonic-gate 
1917c478bd9Sstevel@tonic-gate 	extern	int	Maxfiles;
1927c478bd9Sstevel@tonic-gate 	extern	int	Maxfds;
1937c478bd9Sstevel@tonic-gate 
1947c478bd9Sstevel@tonic-gate 	extern	char	**environ;
1957c478bd9Sstevel@tonic-gate 	extern	char	*optarg;
1967c478bd9Sstevel@tonic-gate 	extern	int	optind, opterr;
1977c478bd9Sstevel@tonic-gate 
1987c478bd9Sstevel@tonic-gate 	extern	int	Nlocked;
1997c478bd9Sstevel@tonic-gate 
2007c478bd9Sstevel@tonic-gate 	extern	sigset_t	Origmask;
2017c478bd9Sstevel@tonic-gate 	extern	struct	sigaction	Sigalrm;	/* SIGALRM */
2027c478bd9Sstevel@tonic-gate 	extern	struct	sigaction	Sigcld;		/* SIGCLD */
2037c478bd9Sstevel@tonic-gate 	extern	struct	sigaction	Sigint;		/* SIGINT */
2047c478bd9Sstevel@tonic-gate 	extern	struct	sigaction	Sigpoll;	/* SIGPOLL */
205b77c815bSNobutomo Nakano 	extern	struct	sigaction	Sigquit;	/* SIGQUIT */
2067c478bd9Sstevel@tonic-gate 	extern	struct	sigaction	Sigterm;	/* SIGTERM */
2077c478bd9Sstevel@tonic-gate #ifdef	DEBUG
2087c478bd9Sstevel@tonic-gate 	extern	struct	sigaction	Sigusr1;	/* SIGUSR1 */
2097c478bd9Sstevel@tonic-gate 	extern	struct	sigaction	Sigusr2;	/* SIGUSR2 */
2107c478bd9Sstevel@tonic-gate #endif
2117c478bd9Sstevel@tonic-gate 
2127c478bd9Sstevel@tonic-gate #ifdef	DEBUG
2137c478bd9Sstevel@tonic-gate 	extern	FILE	*Debugfp;
2147c478bd9Sstevel@tonic-gate 	extern	void	debug(const char *, ...);
2157c478bd9Sstevel@tonic-gate #endif
2167c478bd9Sstevel@tonic-gate 
2177c478bd9Sstevel@tonic-gate 	extern	uid_t	Uucp_uid;
2187c478bd9Sstevel@tonic-gate 	extern	gid_t	Tty_gid;
2197c478bd9Sstevel@tonic-gate 	extern	struct	strbuf *peek_ptr;
2207c478bd9Sstevel@tonic-gate 
2217c478bd9Sstevel@tonic-gate 	extern	int	Logmaxsz;
2227c478bd9Sstevel@tonic-gate 	extern	int	Splflag;
2237c478bd9Sstevel@tonic-gate 
2243bb2c156SToomas Soome /* ttymon.c	*/
225902bba37SToomas Soome 	extern	struct	Gdef *get_speed(struct pmtab *);
2263bb2c156SToomas Soome 	extern	void	open_device(struct pmtab *);
2273bb2c156SToomas Soome 	extern	void	set_softcar(struct pmtab *);
2283bb2c156SToomas Soome 	extern	void	setup_PCpipe(void);
2293bb2c156SToomas Soome 
2303bb2c156SToomas Soome /* ulockf.c	*/
2313bb2c156SToomas Soome 	extern	int	fd_cklock(int);
2323bb2c156SToomas Soome 	extern	int	fd_mklock(int);
2333bb2c156SToomas Soome 
2347c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
2357c478bd9Sstevel@tonic-gate }
2367c478bd9Sstevel@tonic-gate #endif
2377c478bd9Sstevel@tonic-gate 
238d67944fbSScott Rotondo #endif	/* _TMEXTERN_H */
239