clientloop.h revision 255767
1255767Sdes/* $OpenBSD: clientloop.h,v 1.31 2013/06/02 23:36:29 dtucker Exp $ */ 276259Sgreen 376259Sgreen/* 476259Sgreen * Author: Tatu Ylonen <ylo@cs.hut.fi> 576259Sgreen * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 676259Sgreen * All rights reserved 776259Sgreen * 876259Sgreen * As far as I am concerned, the code I have written for this software 976259Sgreen * can be used freely for any purpose. Any derived versions of this 1076259Sgreen * software must be clearly marked as such, and if the derived work is 1176259Sgreen * incompatible with the protocol description in the RFC file, it must be 1276259Sgreen * called by a name other than "ssh" or "Secure Shell". 1376259Sgreen */ 1476259Sgreen/* 1576259Sgreen * Copyright (c) 2001 Markus Friedl. All rights reserved. 1676259Sgreen * 1776259Sgreen * Redistribution and use in source and binary forms, with or without 1876259Sgreen * modification, are permitted provided that the following conditions 1976259Sgreen * are met: 2076259Sgreen * 1. Redistributions of source code must retain the above copyright 2176259Sgreen * notice, this list of conditions and the following disclaimer. 2276259Sgreen * 2. Redistributions in binary form must reproduce the above copyright 2376259Sgreen * notice, this list of conditions and the following disclaimer in the 2476259Sgreen * documentation and/or other materials provided with the distribution. 2576259Sgreen * 2676259Sgreen * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 2776259Sgreen * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 2876259Sgreen * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 2976259Sgreen * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 3076259Sgreen * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 3176259Sgreen * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 3276259Sgreen * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 3376259Sgreen * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 3476259Sgreen * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 3576259Sgreen * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 3676259Sgreen */ 3776259Sgreen 38162852Sdes#include <termios.h> 39162852Sdes 4076259Sgreen/* Client side main loop for the interactive session. */ 4192555Sdesint client_loop(int, int, int); 42215116Sdesvoid client_x11_get_proto(const char *, const char *, u_int, u_int, 43149749Sdes char **, char **); 44126274Sdesvoid client_global_request_reply_fwd(int, u_int32_t, void *); 45137015Sdesvoid client_session2_setup(int, int, int, const char *, struct termios *, 46181111Sdes int, Buffer *, char **); 47181111Sdesint client_request_tun_fwd(int, int, int); 48226046Sdesvoid client_stop_mux(void); 49146998Sdes 50181111Sdes/* Escape filter for protocol 2 sessions */ 51181111Sdesvoid *client_new_escape_filter_ctx(int); 52181111Sdesvoid client_filter_cleanup(int, void *); 53181111Sdesint client_simple_escape_filter(Channel *, char *, int); 54181111Sdes 55181111Sdes/* Global request confirmation callbacks */ 56181111Sdestypedef void global_confirm_cb(int, u_int32_t seq, void *); 57181111Sdesvoid client_register_global_confirm(global_confirm_cb *, void *); 58181111Sdes 59226046Sdes/* Channel request confirmation callbacks */ 60226046Sdesenum confirm_action { CONFIRM_WARN = 0, CONFIRM_CLOSE, CONFIRM_TTY }; 61226046Sdesvoid client_expect_confirm(int, const char *, enum confirm_action); 62226046Sdes 63149749Sdes/* Multiplexing protocol version */ 64204917Sdes#define SSHMUX_VER 4 65149749Sdes 66146998Sdes/* Multiplexing control protocol flags */ 67146998Sdes#define SSHMUX_COMMAND_OPEN 1 /* Open new connection */ 68146998Sdes#define SSHMUX_COMMAND_ALIVE_CHECK 2 /* Check master is alive */ 69146998Sdes#define SSHMUX_COMMAND_TERMINATE 3 /* Ask master to exit */ 70204917Sdes#define SSHMUX_COMMAND_STDIO_FWD 4 /* Open stdio fwd (ssh -W) */ 71215116Sdes#define SSHMUX_COMMAND_FORWARD 5 /* Forward only, no command */ 72226046Sdes#define SSHMUX_COMMAND_STOP 6 /* Disable mux but not conn */ 73240075Sdes#define SSHMUX_COMMAND_CANCEL_FWD 7 /* Cancel forwarding(s) */ 74146998Sdes 75181111Sdesvoid muxserver_listen(void); 76181111Sdesvoid muxclient(const char *); 77204917Sdesvoid mux_exit_message(Channel *, int); 78226046Sdesvoid mux_tty_alloc_failed(Channel *); 79226046Sdes 80