session.h revision 126277
1228753Smm/*	$OpenBSD: session.h,v 1.21 2003/09/23 20:17:11 markus Exp $	*/
2231200Smm
3228753Smm/*
4228753Smm * Copyright (c) 2000, 2001 Markus Friedl.  All rights reserved.
5228753Smm *
6228753Smm * Redistribution and use in source and binary forms, with or without
7228753Smm * modification, are permitted provided that the following conditions
8228753Smm * are met:
9228753Smm * 1. Redistributions of source code must retain the above copyright
10228753Smm *    notice, this list of conditions and the following disclaimer.
11228753Smm * 2. Redistributions in binary form must reproduce the above copyright
12228753Smm *    notice, this list of conditions and the following disclaimer in the
13228753Smm *    documentation and/or other materials provided with the distribution.
14228753Smm *
15228753Smm * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
16228753Smm * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17228753Smm * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18228753Smm * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
19228753Smm * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20228753Smm * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21228753Smm * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22228753Smm * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23228753Smm * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24228753Smm * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25228753Smm */
26228753Smm#ifndef SESSION_H
27228753Smm#define SESSION_H
28228753Smm
29228753Smm#define TTYSZ 64
30228753Smmtypedef struct Session Session;
31228753Smmstruct Session {
32231200Smm	int	used;
33228753Smm	int	self;
34231200Smm	struct passwd *pw;
35228753Smm	Authctxt *authctxt;
36228753Smm	pid_t	pid;
37228753Smm	/* tty */
38231200Smm	char	*term;
39231200Smm	int	ptyfd, ttyfd, ptymaster;
40228753Smm	u_int	row, col, xpixel, ypixel;
41231200Smm	char	tty[TTYSZ];
42228753Smm	/* last login */
43228753Smm	char	hostname[MAXHOSTNAMELEN];
44	time_t	last_login_time;
45	/* X11 */
46	u_int	display_number;
47	char	*display;
48	u_int	screen;
49	char	*auth_display;
50	char	*auth_proto;
51	char	*auth_data;
52	int	single_connection;
53	/* proto 2 */
54	int	chanid;
55	int	is_subsystem;
56};
57
58void	 do_authenticated(Authctxt *);
59void	 do_cleanup(Authctxt *);
60
61int	 session_open(Authctxt *, int);
62int	 session_input_channel_req(Channel *, const char *);
63void	 session_close_by_pid(pid_t, int);
64void	 session_close_by_channel(int, void *);
65void	 session_destroy_all(void (*)(Session *));
66void	 session_pty_cleanup2(Session *);
67
68Session	*session_new(void);
69Session	*session_by_tty(char *);
70void	 session_close(Session *);
71void	 do_setusercontext(struct passwd *);
72void	 child_set_env(char ***envp, u_int *envsizep, const char *name,
73		       const char *value);
74
75#endif
76