clientloop.h revision 181111
1218792Snp/* $OpenBSD: clientloop.h,v 1.22 2008/06/12 15:19:17 djm Exp $ */
2218792Snp
3218792Snp/*
4218792Snp * Author: Tatu Ylonen <ylo@cs.hut.fi>
5218792Snp * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
6218792Snp *                    All rights reserved
7218792Snp *
8218792Snp * As far as I am concerned, the code I have written for this software
9218792Snp * can be used freely for any purpose.  Any derived versions of this
10218792Snp * software must be clearly marked as such, and if the derived work is
11218792Snp * incompatible with the protocol description in the RFC file, it must be
12218792Snp * called by a name other than "ssh" or "Secure Shell".
13218792Snp */
14218792Snp/*
15218792Snp * Copyright (c) 2001 Markus Friedl.  All rights reserved.
16218792Snp *
17218792Snp * Redistribution and use in source and binary forms, with or without
18218792Snp * modification, are permitted provided that the following conditions
19218792Snp * are met:
20218792Snp * 1. Redistributions of source code must retain the above copyright
21218792Snp *    notice, this list of conditions and the following disclaimer.
22218792Snp * 2. Redistributions in binary form must reproduce the above copyright
23218792Snp *    notice, this list of conditions and the following disclaimer in the
24218792Snp *    documentation and/or other materials provided with the distribution.
25218792Snp *
26218792Snp * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
27218792Snp * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
28218792Snp * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
29218792Snp * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
30218792Snp * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
31218792Snp * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
32237925Snp * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
33218792Snp * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
34218792Snp * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
35218792Snp * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36218792Snp */
37218792Snp
38237920Snp#include <termios.h>
39219286Snp
40219286Snp/* Client side main loop for the interactive session. */
41265582Snpint	 client_loop(int, int, int);
42219286Snpvoid	 client_x11_get_proto(const char *, const char *, u_int,
43218792Snp	    char **, char **);
44231093Snpvoid	 client_global_request_reply_fwd(int, u_int32_t, void *);
45218792Snpvoid	 client_session2_setup(int, int, int, const char *, struct termios *,
46218792Snp	    int, Buffer *, char **);
47218792Snpint	 client_request_tun_fwd(int, int, int);
48218792Snp
49218792Snp/* Escape filter for protocol 2 sessions */
50218792Snpvoid	*client_new_escape_filter_ctx(int);
51237925Snpvoid	 client_filter_cleanup(int, void *);
52218792Snpint	 client_simple_escape_filter(Channel *, char *, int);
53262807Sdumbbell
54265582Snp/* Global request confirmation callbacks */
55265582Snptypedef void global_confirm_cb(int, u_int32_t seq, void *);
56218792Snpvoid	 client_register_global_confirm(global_confirm_cb *, void *);
57218792Snp
58218792Snp/* Multiplexing protocol version */
59218792Snp#define SSHMUX_VER			2
60218792Snp
61218792Snp/* Multiplexing control protocol flags */
62252495Snp#define SSHMUX_COMMAND_OPEN		1	/* Open new connection */
63252495Snp#define SSHMUX_COMMAND_ALIVE_CHECK	2	/* Check master is alive */
64252495Snp#define SSHMUX_COMMAND_TERMINATE	3	/* Ask master to exit */
65252495Snp
66252495Snp#define SSHMUX_FLAG_TTY			(1)	/* Request tty on open */
67252495Snp#define SSHMUX_FLAG_SUBSYS		(1<<1)	/* Subsystem request on open */
68240169Snp#define SSHMUX_FLAG_X11_FWD		(1<<2)	/* Request X11 forwarding */
69240169Snp#define SSHMUX_FLAG_AGENT_FWD		(1<<3)	/* Request agent forwarding */
70240169Snp
71240169Snpvoid	muxserver_listen(void);
72240169Snpint	muxserver_accept_control(void);
73240169Snpvoid	muxclient(const char *);
74218792Snp