1323134Sdes/* $OpenBSD: session.h,v 1.33 2016/08/13 17:47:41 markus Exp $ */ 276259Sgreen 365668Skris/* 492555Sdes * Copyright (c) 2000, 2001 Markus Friedl. All rights reserved. 565668Skris * 665668Skris * Redistribution and use in source and binary forms, with or without 765668Skris * modification, are permitted provided that the following conditions 865668Skris * are met: 965668Skris * 1. Redistributions of source code must retain the above copyright 1065668Skris * notice, this list of conditions and the following disclaimer. 1165668Skris * 2. Redistributions in binary form must reproduce the above copyright 1265668Skris * notice, this list of conditions and the following disclaimer in the 1365668Skris * documentation and/or other materials provided with the distribution. 1465668Skris * 1565668Skris * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 1665668Skris * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 1765668Skris * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 1865668Skris * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 1965668Skris * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 2065668Skris * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 2165668Skris * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 2265668Skris * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 2365668Skris * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 2465668Skris * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 2565668Skris */ 2660573Skris#ifndef SESSION_H 2760573Skris#define SESSION_H 2860573Skris 2998675Sdes#define TTYSZ 64 3098675Sdestypedef struct Session Session; 3198675Sdesstruct Session { 3298675Sdes int used; 3398675Sdes int self; 34181111Sdes int next_unused; 3598675Sdes struct passwd *pw; 3698675Sdes Authctxt *authctxt; 3798675Sdes pid_t pid; 38162856Sdes 3998675Sdes /* tty */ 4098675Sdes char *term; 4198675Sdes int ptyfd, ttyfd, ptymaster; 4299063Sdes u_int row, col, xpixel, ypixel; 4398675Sdes char tty[TTYSZ]; 44162856Sdes 4598675Sdes /* X11 */ 4699063Sdes u_int display_number; 4798675Sdes char *display; 4899063Sdes u_int screen; 4998675Sdes char *auth_display; 5098675Sdes char *auth_proto; 5198675Sdes char *auth_data; 5298675Sdes int single_connection; 53162856Sdes 5498675Sdes int chanid; 55149753Sdes int *x11_chanids; 5698675Sdes int is_subsystem; 57261320Sdes char *subsys; 58149753Sdes u_int num_env; 59137019Sdes struct { 60137019Sdes char *name; 61137019Sdes char *val; 62162856Sdes } *env; 6398675Sdes}; 6498675Sdes 6592555Sdesvoid do_authenticated(Authctxt *); 66126277Sdesvoid do_cleanup(Authctxt *); 6760573Skris 68106130Sdesint session_open(Authctxt *, int); 69181111Sdesvoid session_unused(int); 7092555Sdesint session_input_channel_req(Channel *, const char *); 7192555Sdesvoid session_close_by_pid(pid_t, int); 7292555Sdesvoid session_close_by_channel(int, void *); 7398675Sdesvoid session_destroy_all(void (*)(Session *)); 74126277Sdesvoid session_pty_cleanup2(Session *); 7560573Skris 7698675SdesSession *session_new(void); 7798675SdesSession *session_by_tty(char *); 7898675Sdesvoid session_close(Session *); 7998941Sdesvoid do_setusercontext(struct passwd *); 80124211Sdesvoid child_set_env(char ***envp, u_int *envsizep, const char *name, 81124211Sdes const char *value); 82124211Sdes 83323129Sdesconst char *session_get_remote_name_or_ip(struct ssh *, u_int, int); 84323129Sdes 8560573Skris#endif 86