-
Notifications
You must be signed in to change notification settings - Fork 1
/
zssh.h
169 lines (129 loc) · 4.51 KB
/
zssh.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
/*
** zssh.h for zssh
**
** Made by Matthieu Lucotte
** Login <gounter@users.sourceforge.net>
**
** Started on Thu Jun 29 19:11:37 2000 Matthieu Lucotte
** Last update Mon Sep 1 23:13:12 2003
*/
/* -------------REMOTE------------- ----------------------------LOCAL---------------------------
* **************
* ** zssh input ** <-
* ******** ******** ******* / ************** \
* ** bash ** <tty=pty> ** sshd ** <==ssh_channel==> ** ssh ** <tty=pty> <initial_tty=...
* ******** ******** ******* \ *************** /
* -> ** zssh output **
* ***************
*
* in file transfer mode the output process is stopped, and the input process forks
* and connects whatever new process is needed
*
* Processs genealogy:
* zssh_input
* / | \
* zssh_output ssh rz
*
*/
#ifndef __ZSSH_H__
#define __ZSSH_H__
#include "config.h"
#include <stdlib.h>
#include <stdio.h>
#include <errno.h>
#include <string.h>
#include <time.h>
#include <grp.h>
#include <signal.h>
#include <ctype.h>
/*#include <term.h> alpha */
#include <sys/types.h>
#include <sys/stat.h>
#ifdef HAVE_TERMIOS_H
#include <termios.h>
#else
#include <termio.h>
#endif /*HAVE_TERMIOS_H*/
#ifdef HAVE_SYS_WAIT_H
#include <sys/wait.h>
#endif /*HAVE_SYS_WAIT_H*/
#ifdef HAVE_SYS_PARAM_H
#include <sys/param.h>
#endif /*HAVE_SYS_PARAM_H*/
#ifdef HAVE_FCNTL_H
#include <fcntl.h>
#endif /*HAVE_FCNTL_H*/
#ifdef HAVE_PATHS_H
#include <paths.h>
#endif /*HAVE_PATHS_H*/
#ifdef HAVE_SYS_IOCTL_H
#include <sys/ioctl.h>
#endif /*HAVE_SYS_IOCTL_H*/
#ifdef HAVE_SYS_TIME_H
#include <sys/time.h>
#endif /*HAVE_SYS_TIME_H*/
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif /*HAVE_UNISTD_H*/
#ifdef HAVE_ERR_H
#include <err.h> /*Net*/
#endif /*HAVE_ERR_H*/
#ifdef HAVE_SYS_CDEFS_H
#include <sys/cdefs.h> /*Net*/
#endif /*HAVE_SYS_CDEFS_H*/
#ifdef _SUNOS_VTOC_8
#define SOLARIS
#endif
#ifndef WAIT_ANY
#define WAIT_ANY (-1)
#endif
#ifndef SECSPERMIN
#define SECSPERMIN (60)
#endif
/*Actions leaving the user in the file xmission mode */
#define C_SHELL 1
#define C_HELP 2
#define C_CD 3
#define C_REPEAT 4
#define C_ESCAPE 5
#define C_VERSION 6
#define C_SUSPEND 7
#define C_DISCONNECT 8
/*Actions exiting xmission mode after completiion */
#define C_RZ 100
#define C_SZ 101
#define C_HOOK 102
#define C_EXIT 103
#define min(a, b) ((a) < (b) ? (a) : (b))
#define max(a, b) ((a) > (b) ? (a) : (b))
#define ZSSH_IO_BUFSIZ max(BUFSIZ, 1024)
typedef struct {
char *name;
int n;
void (*f)(char **av, int master);
} t_act_tab;
extern t_act_tab cmdtab[];
extern int gl_master; /* ssh pty fd */
extern int gl_slave; /* ssh tty fd */
extern int gl_hook_master; /* hook pty fd */
extern int gl_hook_slave; /* hook tty fd */
extern int gl_main_pid;
extern volatile sig_atomic_t gl_child_output; /* pid of child handling output from the pty */
extern volatile sig_atomic_t gl_child_shell; /* pid of shell (ssh) */
extern volatile sig_atomic_t gl_child_rz; /* pid of child forked for use in the local shell */
extern volatile sig_atomic_t gl_child_read; /* pid of hook pty reader */
extern int gl_local_shell_mode;
extern volatile sig_atomic_t gl_interrupt;
extern volatile sig_atomic_t gl_repeat; /* repeat action forever */
extern int gl_force; /* don't ask user questions */
extern int gl_copty; /* attach hook to copty */
extern struct termios gl_tt; /* initial term */
extern struct termios gl_rtt; /* raw mode term */
extern struct termios gl_tt2; /* ssh mode term */
extern struct winsize gl_win;
extern sigset_t gl_sig_mask;
extern char gl_escape; /* gl_escape = 'X' -> escape seq is ^X */
extern char **gl_shav; /* remote shell argv, defaults to ssh -e none */
#include "parse.h"
#include "fun.h"
#endif /* __ZSSH_H__ */