summaryrefslogtreecommitdiff
path: root/usr/src/cmd/ttymon/tmextern.h
blob: 955e5773ff1f3c8ffbfbd08261cd847890a3ced1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
/*
 * CDDL HEADER START
 *
 * The contents of this file are subject to the terms of the
 * Common Development and Distribution License (the "License").
 * You may not use this file except in compliance with the License.
 *
 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
 * or http://www.opensolaris.org/os/licensing.
 * See the License for the specific language governing permissions
 * and limitations under the License.
 *
 * When distributing Covered Code, include this CDDL HEADER in each
 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
 * If applicable, add the following below this CDDL HEADER, with the
 * fields enclosed by brackets "[]" replaced with your own identifying
 * information: Portions Copyright [yyyy] [name of copyright owner]
 *
 * CDDL HEADER END
 */
/*
 * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
 * Use is subject to license terms.
 */

/*	Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T	*/
/*	  All Rights Reserved	*/

#ifndef	_TMEXTERN_H
#define	_TMEXTERN_H

#include <stdio.h>
#include <unistd.h>
#include <sys/poll.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <termio.h>
#include <sys/stermio.h>
#include <sys/termiox.h>
#include "tmstruct.h"

#ifdef	__cplusplus
extern "C" {
#endif

/* admutil.c	*/
	extern	int	find_label(FILE *, char *);

/* sttytable.c	*/
	extern	const char *not_supported[];

/* sttyparse.c	*/
#ifdef EUC
	extern	char	*sttyparse(int, char *[], int, struct termio *,
	    struct termios *, struct termiox *, struct winsize *,
	    eucwidth_t *, struct eucioc *, ldterm_cs_data_user_t *,
	    ldterm_cs_data_user_t *);
	extern	int	get_ttymode(int, struct termio *, struct termios *,
	    struct stio *, struct termiox *, struct winsize *,
	    struct eucioc *, ldterm_cs_data_user_t *);
	extern	int	set_ttymode(int, int, struct termio *, struct termios *,
	    struct stio *, struct termiox *, struct winsize *,
	    struct winsize *, struct eucioc *, ldterm_cs_data_user_t *, int);
#else
	extern	char	*sttyparse(int, char *[], int, struct termio *,
	    struct termios *, struct termiox *, struct winsize *);
	extern	int	get_ttymode(int, struct termio *, struct termios *,
	    struct stio *, struct termiox *, struct winsize *);
	extern	int	set_ttymode(int, int, struct termio *, struct termios *,
	    struct stio *, struct termiox *, struct winsize *,
	    struct winsize *);
#endif

/* tmautobaud.c	*/
	extern	int	auto_termio(int);
	extern	char	*autobaud(int, int);

/* tmchild.c	*/
	extern	void	write_prompt(int, struct pmtab *, int, int);
	extern	void	timedout(void);
	extern	void	tmchild(struct pmtab *);
	extern	void	sigpoll(int);

/* tmexpress.c	*/
	extern	void	ttymon_express(int, char **);
	extern	void	revokedevaccess(char *, uid_t, gid_t, mode_t);

/* tmhandler.c	*/
	extern	void	do_poll(struct pollfd *, int);
	extern	void	sigalarm(int);
	extern	void	sigterm(int);
	extern	void	sigchild(int);
	extern	void	sigpoll_catch(int);
	extern	void	state_change(void);
	extern	void	re_read(void);
	extern	void	got_carrier(struct pmtab *);

/* tmlock.c	*/
	extern	int	tm_checklock(int);
	extern	int	tm_lock(int);
	extern	int	check_session(int);
	extern	char	*lastname(char *);

/* tmlog.c	*/
	extern	void	log(const char *, ...);
	extern	void	fatal(const char *, ...);
	extern	void	openttymonlog(void);

/* tmparse.c	*/
	extern	char	*getword(char *, int *, int);
	extern	char	quoted(char *, int *);

/* tmpeek.c	*/
	extern	int	poll_data(void);
	extern	void	sigint(int);

/* tmpmtab.c	*/
	extern	void	read_pmtab(void);
	extern	void	purge(void);

/* tmsac.c	*/
	extern	void	openpid(void);
	extern	void	openpipes(void);
	extern	void	get_environ(void);
	extern	void	sacpoll(void);

/* tmsig.c	*/
	extern	void catch_signals(void);
	extern	void child_sigcatch(void);

/* tmterm.c	*/
	extern  int	push_linedisc(int, char *, char *);
	extern	int	set_termio(int, char *, char *, int, long);
	extern	int	initial_termio(int, struct pmtab *);
	extern	int	hang_up_line(int);
	extern	void	flush_input(int);

/* tmttydefs.c	*/
	extern	void	read_ttydefs(const char *, int);
	extern	struct	Gdef *find_def(char *);
	extern	void	mkargv(char *, char **, int *, int);
	extern	int	check_flags(char *);
	extern	char	*strsave(char *);

/* tmutmp.c	*/
	extern	int	account(char *);
	extern	void	cleanut(pid_t, int);
	extern	int	checkut_line(char *line);
	extern	void	getty_account(char *);

/* tmutil.c	*/
	extern	int	check_device(char *);
	extern	int	check_cmd(char *);
	extern	void	cons_printf(const char *, ...);
	extern	void	copystr(char *, char *);
	extern	int	strcheck(char *, int);
	extern	int	vml(char *);

/* misc sys call or lib function call */
	extern	int	check_version(int, char *);

#ifdef	SYS_NAME
	extern	void sys_name(int);
#endif


/* tmglobal.c	*/
	extern	struct	Gdef DEFAULT;
	extern	int	Retry;
	extern	struct	rlimit Rlimit;
	extern	struct	pmtab	*PMtab;
	extern	struct	pollfd	*Pollp;
	extern	int	Nentries;

	extern	int	Npollfd;

	extern	struct	Gdef Gdef[];
	extern	int	Ndefs;
	extern	long	Mtime;

	extern	FILE	*Logfp;
	extern	int	Sfd, Pfd;
	extern	int	PCpipe[];
	extern	int	Lckfd;

	extern	char	State;
	extern	char	*Istate;
	extern	char	*Tag;
	extern	int	Reread_flag;

	extern	int	Maxfiles;
	extern	int	Maxfds;

	extern	char	**environ;
	extern	char	*optarg;
	extern	int	optind, opterr;

	extern	int	Nlocked;

	extern	sigset_t	Origmask;
	extern	struct	sigaction	Sigalrm;	/* SIGALRM */
	extern	struct	sigaction	Sigcld;		/* SIGCLD */
	extern	struct	sigaction	Sigint;		/* SIGINT */
	extern	struct	sigaction	Sigpoll;	/* SIGPOLL */
	extern	struct	sigaction	Sigquit;	/* SIGQUIT */
	extern	struct	sigaction	Sigterm;	/* SIGTERM */
#ifdef	DEBUG
	extern	struct	sigaction	Sigusr1;	/* SIGUSR1 */
	extern	struct	sigaction	Sigusr2;	/* SIGUSR2 */
#endif

#ifdef	DEBUG
	extern	FILE	*Debugfp;
	extern	void	debug(const char *, ...);
#endif

	extern	uid_t	Uucp_uid;
	extern	gid_t	Tty_gid;
	extern	struct	strbuf *peek_ptr;

	extern	int	Logmaxsz;
	extern	int	Splflag;

/* ttymon.c	*/
	extern	struct	Gdef *get_speed(struct pmtab *);
	extern	void	open_device(struct pmtab *);
	extern	void	set_softcar(struct pmtab *);
	extern	void	setup_PCpipe(void);

/* ulockf.c	*/
	extern	int	fd_cklock(int);
	extern	int	fd_mklock(int);

#ifdef	__cplusplus
}
#endif

#endif	/* _TMEXTERN_H */