session.h revision 99063
131921Sbrian/*	$OpenBSD: session.h,v 1.18 2002/06/23 21:06:41 deraadt Exp $	*/
231921Sbrian/*	$FreeBSD: head/crypto/openssh/session.h 99063 2002-06-29 11:48:59Z des $	*/
331921Sbrian
431921Sbrian/*
531921Sbrian * Copyright (c) 2000, 2001 Markus Friedl.  All rights reserved.
631921Sbrian *
731921Sbrian * Redistribution and use in source and binary forms, with or without
831921Sbrian * modification, are permitted provided that the following conditions
931921Sbrian * are met:
1031921Sbrian * 1. Redistributions of source code must retain the above copyright
1131921Sbrian *    notice, this list of conditions and the following disclaimer.
1231921Sbrian * 2. Redistributions in binary form must reproduce the above copyright
1331921Sbrian *    notice, this list of conditions and the following disclaimer in the
1431921Sbrian *    documentation and/or other materials provided with the distribution.
1531921Sbrian *
1631921Sbrian * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
1731921Sbrian * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
1831921Sbrian * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
1931921Sbrian * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
2031921Sbrian * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
2131921Sbrian * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
2231921Sbrian * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
2331921Sbrian * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2431921Sbrian * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
2531921Sbrian * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2650479Speter */
2731514Sbrian#ifndef SESSION_H
2831514Sbrian#define SESSION_H
2931518Sbrian
3031514Sbrian#define TTYSZ 64
31typedef struct Session Session;
32struct Session {
33	int	used;
34	int	self;
35	struct passwd *pw;
36	Authctxt *authctxt;
37	pid_t	pid;
38	/* tty */
39	char	*term;
40	int	ptyfd, ttyfd, ptymaster;
41	u_int	row, col, xpixel, ypixel;
42	char	tty[TTYSZ];
43	/* last login */
44	char	hostname[MAXHOSTNAMELEN];
45	time_t	last_login_time;
46	/* X11 */
47	u_int	display_number;
48	char	*display;
49	u_int	screen;
50	char	*auth_display;
51	char	*auth_proto;
52	char	*auth_data;
53	int	single_connection;
54	/* proto 2 */
55	int	chanid;
56	int	is_subsystem;
57};
58
59void	 do_authenticated(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(void *);
67
68Session	*session_new(void);
69Session	*session_by_tty(char *);
70void	 session_close(Session *);
71void	 do_setusercontext(struct passwd *);
72#endif
73