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