Home | History | Annotate | Line # | Download | only in dist
session.h revision 1.8
      1  1.1  christos /*	$NetBSD: session.h,v 1.8 2017/10/07 19:39:19 christos Exp $	*/
      2  1.8  christos /* $OpenBSD: session.h,v 1.35 2017/09/12 06:32:07 djm Exp $ */
      3  1.1  christos 
      4  1.1  christos /*
      5  1.1  christos  * Copyright (c) 2000, 2001 Markus Friedl.  All rights reserved.
      6  1.1  christos  *
      7  1.1  christos  * Redistribution and use in source and binary forms, with or without
      8  1.1  christos  * modification, are permitted provided that the following conditions
      9  1.1  christos  * are met:
     10  1.1  christos  * 1. Redistributions of source code must retain the above copyright
     11  1.1  christos  *    notice, this list of conditions and the following disclaimer.
     12  1.1  christos  * 2. Redistributions in binary form must reproduce the above copyright
     13  1.1  christos  *    notice, this list of conditions and the following disclaimer in the
     14  1.1  christos  *    documentation and/or other materials provided with the distribution.
     15  1.1  christos  *
     16  1.1  christos  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
     17  1.1  christos  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
     18  1.1  christos  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
     19  1.1  christos  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
     20  1.1  christos  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
     21  1.1  christos  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     22  1.1  christos  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     23  1.1  christos  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     24  1.1  christos  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
     25  1.1  christos  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     26  1.1  christos  */
     27  1.1  christos #ifndef SESSION_H
     28  1.1  christos #define SESSION_H
     29  1.1  christos 
     30  1.2  christos #include <tzfile.h>
     31  1.2  christos 
     32  1.1  christos #define TTYSZ 64
     33  1.1  christos typedef struct Session Session;
     34  1.1  christos struct Session {
     35  1.1  christos 	int	used;
     36  1.1  christos 	int	self;
     37  1.1  christos 	int	next_unused;
     38  1.1  christos 	struct passwd *pw;
     39  1.1  christos 	Authctxt *authctxt;
     40  1.1  christos 	pid_t	pid;
     41  1.1  christos 
     42  1.1  christos 	/* tty */
     43  1.1  christos 	char	*term;
     44  1.1  christos 	int	ptyfd, ttyfd, ptymaster;
     45  1.1  christos 	u_int	row, col, xpixel, ypixel;
     46  1.1  christos 	char	tty[TTYSZ];
     47  1.1  christos 
     48  1.1  christos 	/* X11 */
     49  1.1  christos 	u_int	display_number;
     50  1.1  christos 	char	*display;
     51  1.1  christos 	u_int	screen;
     52  1.1  christos 	char	*auth_display;
     53  1.1  christos 	char	*auth_proto;
     54  1.1  christos 	char	*auth_data;
     55  1.1  christos 	int	single_connection;
     56  1.1  christos 
     57  1.1  christos 	int	chanid;
     58  1.1  christos 	int	*x11_chanids;
     59  1.1  christos 	int	is_subsystem;
     60  1.3  christos 	char	*subsys;
     61  1.1  christos 	u_int	num_env;
     62  1.1  christos 	struct {
     63  1.1  christos 		char	*name;
     64  1.1  christos 		char	*val;
     65  1.1  christos 	} *env;
     66  1.1  christos };
     67  1.1  christos 
     68  1.8  christos void	 do_authenticated(struct ssh *, Authctxt *);
     69  1.8  christos void	 do_cleanup(struct ssh *, Authctxt *);
     70  1.1  christos 
     71  1.1  christos int	 session_open(Authctxt *, int);
     72  1.1  christos void	 session_unused(int);
     73  1.8  christos int	 session_input_channel_req(struct ssh *, Channel *, const char *);
     74  1.8  christos void	 session_close_by_pid(struct ssh *ssh, pid_t, int);
     75  1.8  christos void	 session_close_by_channel(struct ssh *, int, void *);
     76  1.8  christos void	 session_destroy_all(struct ssh *, void (*)(Session *));
     77  1.1  christos void	 session_pty_cleanup2(Session *);
     78  1.1  christos 
     79  1.1  christos Session	*session_new(void);
     80  1.1  christos Session	*session_by_tty(char *);
     81  1.8  christos void	 session_close(struct ssh *, Session *);
     82  1.1  christos void	 do_setusercontext(struct passwd *);
     83  1.1  christos 
     84  1.5  christos const char	*session_get_remote_name_or_ip(struct ssh *, u_int, int);
     85  1.5  christos 
     86  1.1  christos #endif
     87