1 /* $NetBSD: clientloop.h,v 1.19 2024/07/08 22:33:43 christos Exp $ */ 2 /* $OpenBSD: clientloop.h,v 1.38 2024/05/17 06:42:04 jsg Exp $ */ 3 4 /* 5 * Author: Tatu Ylonen <ylo@cs.hut.fi> 6 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 7 * All rights reserved 8 * 9 * As far as I am concerned, the code I have written for this software 10 * can be used freely for any purpose. Any derived versions of this 11 * software must be clearly marked as such, and if the derived work is 12 * incompatible with the protocol description in the RFC file, it must be 13 * called by a name other than "ssh" or "Secure Shell". 14 */ 15 /* 16 * Copyright (c) 2001 Markus Friedl. All rights reserved. 17 * 18 * Redistribution and use in source and binary forms, with or without 19 * modification, are permitted provided that the following conditions 20 * are met: 21 * 1. Redistributions of source code must retain the above copyright 22 * notice, this list of conditions and the following disclaimer. 23 * 2. Redistributions in binary form must reproduce the above copyright 24 * notice, this list of conditions and the following disclaimer in the 25 * documentation and/or other materials provided with the distribution. 26 * 27 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 28 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 29 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 30 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 31 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 32 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 33 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 34 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 35 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 36 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 37 */ 38 39 #include <termios.h> 40 41 struct ssh; 42 43 /* Client side main loop for the interactive session. */ 44 int client_loop(struct ssh *, int, int, int); 45 int client_x11_get_proto(struct ssh *, const char *, const char *, 46 u_int, u_int, char **, char **); 47 void client_session2_setup(struct ssh *, int, int, int, 48 const char *, struct termios *, int, struct sshbuf *, char **); 49 char *client_request_tun_fwd(struct ssh *, int, int, int, 50 channel_open_fn *, void *); 51 void client_stop_mux(void); 52 53 /* Escape filter for protocol 2 sessions */ 54 void *client_new_escape_filter_ctx(int); 55 void client_filter_cleanup(struct ssh *, int, void *); 56 int client_simple_escape_filter(struct ssh *, Channel *, const char *, int); 57 58 /* Global request confirmation callbacks */ 59 typedef void global_confirm_cb(struct ssh *, int, u_int32_t, void *); 60 void client_register_global_confirm(global_confirm_cb *, void *); 61 62 /* Channel request confirmation callbacks */ 63 enum confirm_action { CONFIRM_WARN = 0, CONFIRM_CLOSE, CONFIRM_TTY }; 64 void client_expect_confirm(struct ssh *, int, const char *, 65 enum confirm_action); 66 67 /* Multiplexing protocol version */ 68 #define SSHMUX_VER 4 69 70 /* Multiplexing control protocol flags */ 71 #define SSHMUX_COMMAND_OPEN 1 /* Open new connection */ 72 #define SSHMUX_COMMAND_ALIVE_CHECK 2 /* Check master is alive */ 73 #define SSHMUX_COMMAND_TERMINATE 3 /* Ask master to exit */ 74 #define SSHMUX_COMMAND_STDIO_FWD 4 /* Open stdio fwd (ssh -W) */ 75 #define SSHMUX_COMMAND_FORWARD 5 /* Forward only, no command */ 76 #define SSHMUX_COMMAND_STOP 6 /* Disable mux but not conn */ 77 #define SSHMUX_COMMAND_CANCEL_FWD 7 /* Cancel forwarding(s) */ 78 #define SSHMUX_COMMAND_PROXY 8 /* Open new connection */ 79 80 void muxserver_listen(struct ssh *); 81 int muxclient(const char *); 82 void mux_exit_message(struct ssh *, Channel *, int); 83 void mux_tty_alloc_failed(struct ssh *ssh, Channel *); 84 85