diff options
author | Damien Miller <djm@mindrot.org> | 2008-05-19 15:05:07 +1000 |
---|---|---|
committer | Damien Miller <djm@mindrot.org> | 2008-05-19 15:05:07 +1000 |
commit | b84886ba3e362f54b70aefcbe1aa10606309b7d7 (patch) | |
tree | 9346734369c4e527eca83c87a89c05df0ffe4a18 /channels.h | |
parent | db255cad0531047a3e35a95af74ad2e03b054412 (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.h | 26 |
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 *); | |||
64 | typedef int channel_infilter_fn(struct Channel *, char *, int); | 64 | typedef int channel_infilter_fn(struct Channel *, char *, int); |
65 | typedef u_char *channel_outfilter_fn(struct Channel *, u_char **, u_int *); | 65 | typedef u_char *channel_outfilter_fn(struct Channel *, u_char **, u_int *); |
66 | 66 | ||
67 | /* Channel success/failure callbacks */ | ||
68 | typedef void channel_confirm_cb(int, struct Channel *, void *); | ||
69 | typedef void channel_confirm_abandon_cb(struct Channel *, void *); | ||
70 | struct channel_confirm { | ||
71 | TAILQ_ENTRY(channel_confirm) entry; | ||
72 | channel_confirm_cb *cb; | ||
73 | channel_confirm_abandon_cb *abandon_cb; | ||
74 | void *ctx; | ||
75 | }; | ||
76 | TAILQ_HEAD(channel_confirms, channel_confirm); | ||
77 | |||
67 | struct Channel { | 78 | struct 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); | |||
170 | void channel_send_open(int); | 182 | void channel_send_open(int); |
171 | void channel_request_start(int, char *, int); | 183 | void channel_request_start(int, char *, int); |
172 | void channel_register_cleanup(int, channel_callback_fn *, int); | 184 | void channel_register_cleanup(int, channel_callback_fn *, int); |
173 | void channel_register_confirm(int, channel_callback_fn *, void *); | 185 | void channel_register_open_confirm(int, channel_callback_fn *, void *); |
174 | void channel_register_filter(int, channel_infilter_fn *, channel_outfilter_fn *); | 186 | void channel_register_filter(int, channel_infilter_fn *, |
187 | channel_outfilter_fn *); | ||
188 | void channel_register_status_confirm(int, channel_confirm_cb *, | ||
189 | channel_confirm_abandon_cb *, void *); | ||
175 | void channel_cancel_cleanup(int); | 190 | void channel_cancel_cleanup(int); |
176 | int channel_close_fd(int *); | 191 | int channel_close_fd(int *); |
177 | void channel_send_window_changes(void); | 192 | void channel_send_window_changes(void); |
@@ -188,6 +203,7 @@ void channel_input_open_confirmation(int, u_int32_t, void *); | |||
188 | void channel_input_open_failure(int, u_int32_t, void *); | 203 | void channel_input_open_failure(int, u_int32_t, void *); |
189 | void channel_input_port_open(int, u_int32_t, void *); | 204 | void channel_input_port_open(int, u_int32_t, void *); |
190 | void channel_input_window_adjust(int, u_int32_t, void *); | 205 | void channel_input_window_adjust(int, u_int32_t, void *); |
206 | void 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 | ||