Commit eb0ca402 authored by Balázs Scheidler's avatar Balázs Scheidler Committed by Niels Möller
Browse files

* src/proxy_session.c: Updated to Bazsi's latest version.

* src/proxy_session.c (do_proxy_open_channel): Use
format_channel_open().

Rev: src/proxy_session.c:1.4
Rev: src/proxy_session.h:1.4
parent 37173087
......@@ -22,146 +22,18 @@
*/
#include "proxy_session.h"
#include "xalloc.h"
#include "channel_commands.h"
#include "format.h"
#include "proxy_channel.h"
#include "ssh.h"
#include "werror.h"
#include "channel_commands.h"
#include "xalloc.h"
#include "proxy_session.c.x"
#define WINDOW_SIZE (SSH_MAX_PACKET << 3)
/* GABA:
(class
(name proxy_channel)
(super ssh_channel)
(vars
(chain object proxy_channel)
(init_io method void "struct proxy_channel *chain")))
*/
static void
do_receive(struct ssh_channel *c UNUSED,
int type UNUSED,
struct lsh_string *data UNUSED)
{
}
static void
do_send(struct ssh_channel *s UNUSED,
struct ssh_connection *c UNUSED)
{
}
static void
do_eof(struct ssh_channel *channel UNUSED)
{
}
static void
do_proxy_init_io(struct proxy_channel *self,
struct proxy_channel *chain)
{
self->chain = chain;
self->super.send = do_send;
self->super.receive = do_receive;
self->super.eof = do_eof;
}
static struct proxy_channel *
make_proxy_channel(UINT32 window_size,
struct alist *request_types)
{
NEW(proxy_channel, self);
init_channel(&self->super);
self->super.max_window = SSH_MAX_PACKET << 3;
self->super.rec_window_size = window_size;
self->super.rec_max_packet = SSH_MAX_PACKET;
self->super.request_types = request_types;
self->init_io = do_proxy_init_io;
return self;
}
/*
* continuation to handle the returned channel, and chain two channels
* together
*/
/* GABA:
(class
(name proxy_channel_open_continuation)
(super command_continuation)
(vars
(up object command_continuation)
(channel object proxy_channel)))
*/
static void
do_proxy_channel_open_continuation(struct command_continuation *c,
struct lsh_object *x)
{
CAST(proxy_channel_open_continuation, self, c);
CAST(proxy_channel, chain_channel, x);
self->channel->chain = chain_channel;
chain_channel = self->channel;
COMMAND_RETURN(self->up, self->channel);
}
static struct command_continuation *
make_proxy_channel_open_continuation(struct command_continuation *up,
struct proxy_channel *channel)
{
NEW(proxy_channel_open_continuation, self);
self->super.c = do_proxy_channel_open_continuation;
self->channel = channel;
self->up = up;
return &self->super;
}
/* command to request a channel open */
/* GABA:
(class
(name proxy_channel_open_command)
(super channel_open_command)
(vars
; channel type
(type . UINT32)
(requests object alist)))
*/
static struct ssh_channel *
do_proxy_open_channel(struct channel_open_command *c,
struct ssh_connection *connection UNUSED,
UINT32 local_channel_number,
struct lsh_string **request)
{
CAST(proxy_channel_open_command, closure, c);
struct proxy_channel *client = make_proxy_channel(WINDOW_SIZE, closure->requests);
*request = format_channel_open(closure->type, local_channel_number, &client->super, "");
return &client->super;
}
static struct command *
make_proxy_channel_open_command(UINT32 type,
struct alist *requests)
{
NEW(proxy_channel_open_command, self);
self->super.new_channel = do_proxy_open_channel;
self->super.super.call = do_channel_open_command;
self->type = type;
self->requests = requests;
return &self->super.super;
}
/* GABA:
(class
......@@ -189,8 +61,9 @@ do_proxy_open_session(struct channel_open *s,
if (parse_eod(args))
{
struct proxy_channel *server = make_proxy_channel(WINDOW_SIZE, closure->server_requests);
struct command *o = make_proxy_channel_open_command(type, closure->client_requests);
struct proxy_channel *server = make_proxy_channel(WINDOW_SIZE, closure->server_requests, 0);
struct command *o =
make_proxy_channel_open_command(type, ssh_format(""), closure->client_requests);
COMMAND_CALL(o,
connection->chain,
......
......@@ -31,7 +31,4 @@ struct channel_open *
make_proxy_open_session(struct alist *server_requests,
struct alist *client_requests);
struct channel_request *
make_proxy_channel_request(void);
#endif /* LSH_PROXY_SESSION_H_INCLUDED */
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment