1/*	$NetBSD: clientloop.h,v 1.4 2011/07/25 03:03:10 christos Exp $	*/
2/* $OpenBSD: clientloop.h,v 1.28 2011/06/22 22:08:42 djm 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/* Client side main loop for the interactive session. */
42int	 client_loop(int, int, int);
43void	 client_x11_get_proto(const char *, const char *, u_int, u_int,
44	    char **, char **);
45void	 client_global_request_reply_fwd(int, u_int32_t, void *);
46void	 client_session2_setup(int, int, int, const char *, struct termios *,
47	    int, Buffer *, char **);
48int	 client_request_tun_fwd(int, int, int);
49void	 client_stop_mux(void);
50
51/* Escape filter for protocol 2 sessions */
52void	*client_new_escape_filter_ctx(int);
53void	 client_filter_cleanup(int, void *);
54int	 client_simple_escape_filter(Channel *, const char *, int);
55
56/* Global request confirmation callbacks */
57typedef void global_confirm_cb(int, u_int32_t seq, void *);
58void	 client_register_global_confirm(global_confirm_cb *, void *);
59
60/* Channel request confirmation callbacks */
61enum confirm_action { CONFIRM_WARN = 0, CONFIRM_CLOSE, CONFIRM_TTY };
62void client_expect_confirm(int, const char *, enum confirm_action);
63
64/* Multiplexing protocol version */
65#define SSHMUX_VER			4
66
67/* Multiplexing control protocol flags */
68#define SSHMUX_COMMAND_OPEN		1	/* Open new connection */
69#define SSHMUX_COMMAND_ALIVE_CHECK	2	/* Check master is alive */
70#define SSHMUX_COMMAND_TERMINATE	3	/* Ask master to exit */
71#define SSHMUX_COMMAND_STDIO_FWD	4	/* Open stdio fwd (ssh -W) */
72#define SSHMUX_COMMAND_FORWARD		5	/* Forward only, no command */
73#define SSHMUX_COMMAND_STOP		6	/* Disable mux but not conn */
74
75void	muxserver_listen(void);
76void	muxclient(const char *);
77void	mux_exit_message(Channel *, int);
78void	mux_tty_alloc_failed(Channel *);
79
80