1f7fc46c63fdc8f39234fea409b8dbe116d73ebf8The Android Open Source Project/*
2f7fc46c63fdc8f39234fea409b8dbe116d73ebf8The Android Open Source Project * Dropbear - a SSH2 server
3f7fc46c63fdc8f39234fea409b8dbe116d73ebf8The Android Open Source Project *
4f7fc46c63fdc8f39234fea409b8dbe116d73ebf8The Android Open Source Project * Copyright (c) 2002,2003 Matt Johnston
5f7fc46c63fdc8f39234fea409b8dbe116d73ebf8The Android Open Source Project * All rights reserved.
6f7fc46c63fdc8f39234fea409b8dbe116d73ebf8The Android Open Source Project *
7f7fc46c63fdc8f39234fea409b8dbe116d73ebf8The Android Open Source Project * Permission is hereby granted, free of charge, to any person obtaining a copy
8f7fc46c63fdc8f39234fea409b8dbe116d73ebf8The Android Open Source Project * of this software and associated documentation files (the "Software"), to deal
9f7fc46c63fdc8f39234fea409b8dbe116d73ebf8The Android Open Source Project * in the Software without restriction, including without limitation the rights
10f7fc46c63fdc8f39234fea409b8dbe116d73ebf8The Android Open Source Project * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11f7fc46c63fdc8f39234fea409b8dbe116d73ebf8The Android Open Source Project * copies of the Software, and to permit persons to whom the Software is
12f7fc46c63fdc8f39234fea409b8dbe116d73ebf8The Android Open Source Project * furnished to do so, subject to the following conditions:
13f7fc46c63fdc8f39234fea409b8dbe116d73ebf8The Android Open Source Project *
14f7fc46c63fdc8f39234fea409b8dbe116d73ebf8The Android Open Source Project * The above copyright notice and this permission notice shall be included in
15f7fc46c63fdc8f39234fea409b8dbe116d73ebf8The Android Open Source Project * all copies or substantial portions of the Software.
16f7fc46c63fdc8f39234fea409b8dbe116d73ebf8The Android Open Source Project *
17f7fc46c63fdc8f39234fea409b8dbe116d73ebf8The Android Open Source Project * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18f7fc46c63fdc8f39234fea409b8dbe116d73ebf8The Android Open Source Project * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19f7fc46c63fdc8f39234fea409b8dbe116d73ebf8The Android Open Source Project * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20f7fc46c63fdc8f39234fea409b8dbe116d73ebf8The Android Open Source Project * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21f7fc46c63fdc8f39234fea409b8dbe116d73ebf8The Android Open Source Project * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22f7fc46c63fdc8f39234fea409b8dbe116d73ebf8The Android Open Source Project * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23f7fc46c63fdc8f39234fea409b8dbe116d73ebf8The Android Open Source Project * SOFTWARE. */
24f7fc46c63fdc8f39234fea409b8dbe116d73ebf8The Android Open Source Project
25f7fc46c63fdc8f39234fea409b8dbe116d73ebf8The Android Open Source Project#ifndef _CHANSESSION_H_
26f7fc46c63fdc8f39234fea409b8dbe116d73ebf8The Android Open Source Project#define _CHANSESSION_H_
27f7fc46c63fdc8f39234fea409b8dbe116d73ebf8The Android Open Source Project
28f7fc46c63fdc8f39234fea409b8dbe116d73ebf8The Android Open Source Project#include "loginrec.h"
29f7fc46c63fdc8f39234fea409b8dbe116d73ebf8The Android Open Source Project#include "channel.h"
30f7fc46c63fdc8f39234fea409b8dbe116d73ebf8The Android Open Source Project#include "listener.h"
31f7fc46c63fdc8f39234fea409b8dbe116d73ebf8The Android Open Source Project
32f7fc46c63fdc8f39234fea409b8dbe116d73ebf8The Android Open Source Projectstruct exitinfo {
33f7fc46c63fdc8f39234fea409b8dbe116d73ebf8The Android Open Source Project
34f7fc46c63fdc8f39234fea409b8dbe116d73ebf8The Android Open Source Project	int exitpid; /* -1 if not exited */
35f7fc46c63fdc8f39234fea409b8dbe116d73ebf8The Android Open Source Project	int exitstatus;
36f7fc46c63fdc8f39234fea409b8dbe116d73ebf8The Android Open Source Project	int exitsignal;
37f7fc46c63fdc8f39234fea409b8dbe116d73ebf8The Android Open Source Project	int exitcore;
38f7fc46c63fdc8f39234fea409b8dbe116d73ebf8The Android Open Source Project};
39f7fc46c63fdc8f39234fea409b8dbe116d73ebf8The Android Open Source Project
40f7fc46c63fdc8f39234fea409b8dbe116d73ebf8The Android Open Source Projectstruct ChanSess {
41f7fc46c63fdc8f39234fea409b8dbe116d73ebf8The Android Open Source Project
42f7fc46c63fdc8f39234fea409b8dbe116d73ebf8The Android Open Source Project	unsigned char * cmd; /* command to exec */
43f7fc46c63fdc8f39234fea409b8dbe116d73ebf8The Android Open Source Project	pid_t pid; /* child process pid */
44f7fc46c63fdc8f39234fea409b8dbe116d73ebf8The Android Open Source Project
45f7fc46c63fdc8f39234fea409b8dbe116d73ebf8The Android Open Source Project	/* pty details */
46f7fc46c63fdc8f39234fea409b8dbe116d73ebf8The Android Open Source Project	int master; /* the master terminal fd*/
47f7fc46c63fdc8f39234fea409b8dbe116d73ebf8The Android Open Source Project	int slave;
48f7fc46c63fdc8f39234fea409b8dbe116d73ebf8The Android Open Source Project	unsigned char * tty;
49f7fc46c63fdc8f39234fea409b8dbe116d73ebf8The Android Open Source Project	unsigned char * term;
50f7fc46c63fdc8f39234fea409b8dbe116d73ebf8The Android Open Source Project
51f7fc46c63fdc8f39234fea409b8dbe116d73ebf8The Android Open Source Project	/* exit details */
52f7fc46c63fdc8f39234fea409b8dbe116d73ebf8The Android Open Source Project	struct exitinfo exit;
53f7fc46c63fdc8f39234fea409b8dbe116d73ebf8The Android Open Source Project
54f7fc46c63fdc8f39234fea409b8dbe116d73ebf8The Android Open Source Project#ifndef DISABLE_X11FWD
55f7fc46c63fdc8f39234fea409b8dbe116d73ebf8The Android Open Source Project	struct Listener * x11listener;
56f7fc46c63fdc8f39234fea409b8dbe116d73ebf8The Android Open Source Project	int x11port;
57f7fc46c63fdc8f39234fea409b8dbe116d73ebf8The Android Open Source Project	char * x11authprot;
58f7fc46c63fdc8f39234fea409b8dbe116d73ebf8The Android Open Source Project	char * x11authcookie;
59f7fc46c63fdc8f39234fea409b8dbe116d73ebf8The Android Open Source Project	unsigned int x11screennum;
60f7fc46c63fdc8f39234fea409b8dbe116d73ebf8The Android Open Source Project	unsigned char x11singleconn;
61f7fc46c63fdc8f39234fea409b8dbe116d73ebf8The Android Open Source Project#endif
62f7fc46c63fdc8f39234fea409b8dbe116d73ebf8The Android Open Source Project
63f7fc46c63fdc8f39234fea409b8dbe116d73ebf8The Android Open Source Project#ifndef DISABLE_AGENTFWD
64f7fc46c63fdc8f39234fea409b8dbe116d73ebf8The Android Open Source Project	struct Listener * agentlistener;
65f7fc46c63fdc8f39234fea409b8dbe116d73ebf8The Android Open Source Project	char * agentfile;
66f7fc46c63fdc8f39234fea409b8dbe116d73ebf8The Android Open Source Project	char * agentdir;
67f7fc46c63fdc8f39234fea409b8dbe116d73ebf8The Android Open Source Project#endif
68f7fc46c63fdc8f39234fea409b8dbe116d73ebf8The Android Open Source Project};
69f7fc46c63fdc8f39234fea409b8dbe116d73ebf8The Android Open Source Project
70f7fc46c63fdc8f39234fea409b8dbe116d73ebf8The Android Open Source Projectstruct ChildPid {
71f7fc46c63fdc8f39234fea409b8dbe116d73ebf8The Android Open Source Project	pid_t pid;
72f7fc46c63fdc8f39234fea409b8dbe116d73ebf8The Android Open Source Project	struct ChanSess * chansess;
73f7fc46c63fdc8f39234fea409b8dbe116d73ebf8The Android Open Source Project};
74f7fc46c63fdc8f39234fea409b8dbe116d73ebf8The Android Open Source Project
75f7fc46c63fdc8f39234fea409b8dbe116d73ebf8The Android Open Source Project
76f7fc46c63fdc8f39234fea409b8dbe116d73ebf8The Android Open Source Projectvoid addnewvar(const char* param, const char* var);
77f7fc46c63fdc8f39234fea409b8dbe116d73ebf8The Android Open Source Project
78f7fc46c63fdc8f39234fea409b8dbe116d73ebf8The Android Open Source Projectvoid cli_send_chansess_request();
79f7fc46c63fdc8f39234fea409b8dbe116d73ebf8The Android Open Source Projectvoid cli_tty_cleanup();
80f7fc46c63fdc8f39234fea409b8dbe116d73ebf8The Android Open Source Projectvoid cli_chansess_winchange();
81f7fc46c63fdc8f39234fea409b8dbe116d73ebf8The Android Open Source Project
82f7fc46c63fdc8f39234fea409b8dbe116d73ebf8The Android Open Source Projectvoid svr_chansessinitialise();
83f7fc46c63fdc8f39234fea409b8dbe116d73ebf8The Android Open Source Projectextern const struct ChanType svrchansess;
84f7fc46c63fdc8f39234fea409b8dbe116d73ebf8The Android Open Source Project
85f7fc46c63fdc8f39234fea409b8dbe116d73ebf8The Android Open Source Projectstruct SigMap {
86f7fc46c63fdc8f39234fea409b8dbe116d73ebf8The Android Open Source Project	int signal;
87f7fc46c63fdc8f39234fea409b8dbe116d73ebf8The Android Open Source Project	char* name;
88f7fc46c63fdc8f39234fea409b8dbe116d73ebf8The Android Open Source Project};
89f7fc46c63fdc8f39234fea409b8dbe116d73ebf8The Android Open Source Project
90f7fc46c63fdc8f39234fea409b8dbe116d73ebf8The Android Open Source Projectextern const struct SigMap signames[];
91f7fc46c63fdc8f39234fea409b8dbe116d73ebf8The Android Open Source Project
92f7fc46c63fdc8f39234fea409b8dbe116d73ebf8The Android Open Source Project#endif /* _CHANSESSION_H_ */
93