summaryrefslogtreecommitdiff
path: root/channels.h
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2008-05-19 15:05:07 +1000
committerDamien Miller <djm@mindrot.org>2008-05-19 15:05:07 +1000
commitb84886ba3e362f54b70aefcbe1aa10606309b7d7 (patch)
tree9346734369c4e527eca83c87a89c05df0ffe4a18 /channels.h
parentdb255cad0531047a3e35a95af74ad2e03b054412 (diff)
- djm@cvs.openbsd.org 2008/05/08 12:02:23
[auth-options.c auth1.c channels.c channels.h clientloop.c gss-serv.c] [monitor.c monitor_wrap.c nchan.c servconf.c serverloop.c session.c] [ssh.c sshd.c] Implement a channel success/failure status confirmation callback mechanism. Each channel maintains a queue of callbacks, which will be drained in order (RFC4253 guarantees confirm messages are not reordered within an channel). Also includes a abandonment callback to clean up if a channel is closed without sending confirmation messages. This probably shouldn't happen in compliant implementations, but it could be abused to leak memory. ok markus@ (as part of a larger diff)
Diffstat (limited to 'channels.h')
-rw-r--r--channels.h26
1 files changed, 21 insertions, 5 deletions
diff --git a/channels.h b/channels.h
index b632a86af..46cde0309 100644
--- a/channels.h
+++ b/channels.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: channels.h,v 1.89 2007/06/11 09:14:00 markus Exp $ */ 1/* $OpenBSD: channels.h,v 1.90 2008/05/08 12:02:23 djm Exp $ */
2 2
3/* 3/*
4 * Author: Tatu Ylonen <ylo@cs.hut.fi> 4 * Author: Tatu Ylonen <ylo@cs.hut.fi>
@@ -64,6 +64,17 @@ typedef void channel_callback_fn(int, void *);
64typedef int channel_infilter_fn(struct Channel *, char *, int); 64typedef int channel_infilter_fn(struct Channel *, char *, int);
65typedef u_char *channel_outfilter_fn(struct Channel *, u_char **, u_int *); 65typedef u_char *channel_outfilter_fn(struct Channel *, u_char **, u_int *);
66 66
67/* Channel success/failure callbacks */
68typedef void channel_confirm_cb(int, struct Channel *, void *);
69typedef void channel_confirm_abandon_cb(struct Channel *, void *);
70struct channel_confirm {
71 TAILQ_ENTRY(channel_confirm) entry;
72 channel_confirm_cb *cb;
73 channel_confirm_abandon_cb *abandon_cb;
74 void *ctx;
75};
76TAILQ_HEAD(channel_confirms, channel_confirm);
77
67struct Channel { 78struct Channel {
68 int type; /* channel type/state */ 79 int type; /* channel type/state */
69 int self; /* my own channel identifier */ 80 int self; /* my own channel identifier */
@@ -104,10 +115,11 @@ struct Channel {
104 char *ctype; /* type */ 115 char *ctype; /* type */
105 116
106 /* callback */ 117 /* callback */
107 channel_callback_fn *confirm; 118 channel_callback_fn *open_confirm;
108 void *confirm_ctx; 119 void *open_confirm_ctx;
109 channel_callback_fn *detach_user; 120 channel_callback_fn *detach_user;
110 int detach_close; 121 int detach_close;
122 struct channel_confirms status_confirms;
111 123
112 /* filter */ 124 /* filter */
113 channel_infilter_fn *input_filter; 125 channel_infilter_fn *input_filter;
@@ -170,8 +182,11 @@ void channel_stop_listening(void);
170void channel_send_open(int); 182void channel_send_open(int);
171void channel_request_start(int, char *, int); 183void channel_request_start(int, char *, int);
172void channel_register_cleanup(int, channel_callback_fn *, int); 184void channel_register_cleanup(int, channel_callback_fn *, int);
173void channel_register_confirm(int, channel_callback_fn *, void *); 185void channel_register_open_confirm(int, channel_callback_fn *, void *);
174void channel_register_filter(int, channel_infilter_fn *, channel_outfilter_fn *); 186void channel_register_filter(int, channel_infilter_fn *,
187 channel_outfilter_fn *);
188void channel_register_status_confirm(int, channel_confirm_cb *,
189 channel_confirm_abandon_cb *, void *);
175void channel_cancel_cleanup(int); 190void channel_cancel_cleanup(int);
176int channel_close_fd(int *); 191int channel_close_fd(int *);
177void channel_send_window_changes(void); 192void channel_send_window_changes(void);
@@ -188,6 +203,7 @@ void channel_input_open_confirmation(int, u_int32_t, void *);
188void channel_input_open_failure(int, u_int32_t, void *); 203void channel_input_open_failure(int, u_int32_t, void *);
189void channel_input_port_open(int, u_int32_t, void *); 204void channel_input_port_open(int, u_int32_t, void *);
190void channel_input_window_adjust(int, u_int32_t, void *); 205void channel_input_window_adjust(int, u_int32_t, void *);
206void channel_input_status_confirm(int, u_int32_t, void *);
191 207
192/* file descriptor handling (read/write) */ 208/* file descriptor handling (read/write) */
193 209