summaryrefslogtreecommitdiff
path: root/channels.h
diff options
context:
space:
mode:
Diffstat (limited to 'channels.h')
-rw-r--r--channels.h23
1 files changed, 19 insertions, 4 deletions
diff --git a/channels.h b/channels.h
index 1488ed7e5..cc71885f4 100644
--- a/channels.h
+++ b/channels.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: channels.h,v 1.98 2009/02/12 03:00:56 djm Exp $ */ 1/* $OpenBSD: channels.h,v 1.103 2010/01/26 01:28:35 djm Exp $ */
2 2
3/* 3/*
4 * Author: Tatu Ylonen <ylo@cs.hut.fi> 4 * Author: Tatu Ylonen <ylo@cs.hut.fi>
@@ -53,7 +53,9 @@
53#define SSH_CHANNEL_CONNECTING 12 53#define SSH_CHANNEL_CONNECTING 12
54#define SSH_CHANNEL_DYNAMIC 13 54#define SSH_CHANNEL_DYNAMIC 13
55#define SSH_CHANNEL_ZOMBIE 14 /* Almost dead. */ 55#define SSH_CHANNEL_ZOMBIE 14 /* Almost dead. */
56#define SSH_CHANNEL_MAX_TYPE 15 56#define SSH_CHANNEL_MUX_LISTENER 15 /* Listener for mux conn. */
57#define SSH_CHANNEL_MUX_CLIENT 16 /* Conn. to mux slave */
58#define SSH_CHANNEL_MAX_TYPE 17
57 59
58struct Channel; 60struct Channel;
59typedef struct Channel Channel; 61typedef struct Channel Channel;
@@ -81,6 +83,9 @@ struct channel_connect {
81 struct addrinfo *ai, *aitop; 83 struct addrinfo *ai, *aitop;
82}; 84};
83 85
86/* Callbacks for mux channels back into client-specific code */
87typedef int mux_callback_fn(struct Channel *);
88
84struct Channel { 89struct Channel {
85 int type; /* channel type/state */ 90 int type; /* channel type/state */
86 int self; /* my own channel identifier */ 91 int self; /* my own channel identifier */
@@ -92,12 +97,16 @@ struct Channel {
92 int wfd; /* write fd */ 97 int wfd; /* write fd */
93 int efd; /* extended fd */ 98 int efd; /* extended fd */
94 int sock; /* sock fd */ 99 int sock; /* sock fd */
95 int ctl_fd; /* control fd (client sharing) */ 100 int ctl_chan; /* control channel (multiplexed connections) */
96 int isatty; /* rfd is a tty */ 101 int isatty; /* rfd is a tty */
97 int wfd_isatty; /* wfd is a tty */ 102 int wfd_isatty; /* wfd is a tty */
98 int client_tty; /* (client) TTY has been requested */ 103 int client_tty; /* (client) TTY has been requested */
99 int force_drain; /* force close on iEOF */ 104 int force_drain; /* force close on iEOF */
100 int delayed; /* fdset hack */ 105 int delayed; /* post-select handlers for newly created
106 * channels are delayed until the first call
107 * to a matching pre-select handler.
108 * this way post-select handlers are not
109 * accidenly called if a FD gets reused */
101 Buffer input; /* data read from socket, to be sent over 110 Buffer input; /* data read from socket, to be sent over
102 * encrypted connection */ 111 * encrypted connection */
103 Buffer output; /* data received over encrypted connection for 112 Buffer output; /* data received over encrypted connection for
@@ -138,6 +147,10 @@ struct Channel {
138 147
139 /* non-blocking connect */ 148 /* non-blocking connect */
140 struct channel_connect connect_ctx; 149 struct channel_connect connect_ctx;
150
151 /* multiplexing protocol hook, called for each packet received */
152 mux_callback_fn *mux_rcb;
153 void *mux_ctx;
141}; 154};
142 155
143#define CHAN_EXTENDED_IGNORE 0 156#define CHAN_EXTENDED_IGNORE 0
@@ -168,6 +181,7 @@ struct Channel {
168#define CHAN_CLOSE_RCVD 0x02 181#define CHAN_CLOSE_RCVD 0x02
169#define CHAN_EOF_SENT 0x04 182#define CHAN_EOF_SENT 0x04
170#define CHAN_EOF_RCVD 0x08 183#define CHAN_EOF_RCVD 0x08
184#define CHAN_LOCAL 0x10
171 185
172#define CHAN_RBUF 16*1024 186#define CHAN_RBUF 16*1024
173 187
@@ -239,6 +253,7 @@ void channel_clear_adm_permitted_opens(void);
239void channel_print_adm_permitted_opens(void); 253void channel_print_adm_permitted_opens(void);
240int channel_input_port_forward_request(int, int); 254int channel_input_port_forward_request(int, int);
241Channel *channel_connect_to(const char *, u_short, char *, char *); 255Channel *channel_connect_to(const char *, u_short, char *, char *);
256Channel *channel_connect_stdio_fwd(const char*, u_short, int, int);
242Channel *channel_connect_by_listen_address(u_short, char *, char *); 257Channel *channel_connect_by_listen_address(u_short, char *, char *);
243int channel_request_remote_forwarding(const char *, u_short, 258int channel_request_remote_forwarding(const char *, u_short,
244 const char *, u_short); 259 const char *, u_short);