session.h revision 106130
1106130Sdes/*	$OpenBSD: session.h,v 1.19 2002/06/30 21:59:45 deraadt Exp $	*/
299063Sdes/*	$FreeBSD: head/crypto/openssh/session.h 106130 2002-10-29 10:16:02Z des $	*/
376259Sgreen
465668Skris/*
592555Sdes * Copyright (c) 2000, 2001 Markus Friedl.  All rights reserved.
665668Skris *
765668Skris * Redistribution and use in source and binary forms, with or without
865668Skris * modification, are permitted provided that the following conditions
965668Skris * are met:
1065668Skris * 1. Redistributions of source code must retain the above copyright
1165668Skris *    notice, this list of conditions and the following disclaimer.
1265668Skris * 2. Redistributions in binary form must reproduce the above copyright
1365668Skris *    notice, this list of conditions and the following disclaimer in the
1465668Skris *    documentation and/or other materials provided with the distribution.
1565668Skris *
1665668Skris * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
1765668Skris * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
1865668Skris * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
1965668Skris * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
2065668Skris * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
2165668Skris * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
2265668Skris * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
2365668Skris * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2465668Skris * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
2565668Skris * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2665668Skris */
2760573Skris#ifndef SESSION_H
2860573Skris#define SESSION_H
2960573Skris
3098675Sdes#define TTYSZ 64
3198675Sdestypedef struct Session Session;
3298675Sdesstruct Session {
3398675Sdes	int	used;
3498675Sdes	int	self;
3598675Sdes	struct passwd *pw;
3698675Sdes	Authctxt *authctxt;
3798675Sdes	pid_t	pid;
3898675Sdes	/* tty */
3998675Sdes	char	*term;
4098675Sdes	int	ptyfd, ttyfd, ptymaster;
4199063Sdes	u_int	row, col, xpixel, ypixel;
4298675Sdes	char	tty[TTYSZ];
4398675Sdes	/* last login */
4498675Sdes	char	hostname[MAXHOSTNAMELEN];
4598675Sdes	time_t	last_login_time;
4698675Sdes	/* X11 */
4799063Sdes	u_int	display_number;
4898675Sdes	char	*display;
4999063Sdes	u_int	screen;
5098675Sdes	char	*auth_display;
5198675Sdes	char	*auth_proto;
5298675Sdes	char	*auth_data;
5398675Sdes	int	single_connection;
5498675Sdes	/* proto 2 */
5598675Sdes	int	chanid;
5698675Sdes	int	is_subsystem;
5798675Sdes};
5898675Sdes
5992555Sdesvoid	 do_authenticated(Authctxt *);
6060573Skris
61106130Sdesint	 session_open(Authctxt *, int);
6292555Sdesint	 session_input_channel_req(Channel *, const char *);
6392555Sdesvoid	 session_close_by_pid(pid_t, int);
6492555Sdesvoid	 session_close_by_channel(int, void *);
6598675Sdesvoid	 session_destroy_all(void (*)(Session *));
6698675Sdesvoid	 session_pty_cleanup2(void *);
6760573Skris
6898675SdesSession	*session_new(void);
6998675SdesSession	*session_by_tty(char *);
7098675Sdesvoid	 session_close(Session *);
7198941Sdesvoid	 do_setusercontext(struct passwd *);
7260573Skris#endif
73