Commit 1e7d9e07 authored by Niels Möller's avatar Niels Möller
Browse files

* src/gateway_commands.c (gateway_setup_command): Use

(gateway_accept): Use DEFINE_COMMAND2.

Rev: src/gateway_commands.c:1.11
Rev: src/gateway_commands.h:1.2
parent 151e799f
......@@ -142,7 +142,8 @@ gateway_make_connection(struct listen_value *lv,
(struct command *s UNUSED, struct lsh_object *a,
(struct command *s UNUSED,
struct lsh_object *a,
struct command_continuation *c,
struct exception_handler *e)
......@@ -153,36 +154,26 @@ DEFINE_COMMAND(gateway_init)
/* (gateway_accept main-connection gateway-connection) */
static void
do_gateway_accept(struct command *s,
struct lsh_object *x,
(struct command_2 *s UNUSED,
struct lsh_object *a1,
struct lsh_object *a2,
struct command_continuation *c,
struct exception_handler *e)
CAST(connection_command, self, s);
CAST(listen_value, lv, x);
CAST(ssh_connection, connection, a1);
CAST(listen_value, lv, a2);
struct ssh_connection *gateway = gateway_make_connection(lv, e);
/* Kill gateway connection if the main connection goes down. */
REMEMBER_RESOURCE(self->connection->resources, &lv->fd->super);
REMEMBER_RESOURCE(connection->resources, &lv->fd->super);
gateway->chain = self->connection;
gateway->chain = connection;
COMMAND_RETURN(c, gateway);
DEFINE_COMMAND_SIMPLE(gateway_accept, a)
CAST(ssh_connection, connection, a);
NEW(connection_command, self);
self->connection = connection;
self-> = do_gateway_accept;
return &self->super.super;
/* GABA:
......@@ -208,11 +199,15 @@ make_gateway_setup(struct command *listen)
return res;
DEFINE_COMMAND_SIMPLE(gateway_setup_command, a)
(struct command *s UNUSED,
struct lsh_object *a,
struct command_continuation *c,
struct exception_handler *e UNUSED)
CAST_SUBTYPE(command, listen, a);
CAST_SUBTYPE(command, res,
return &res->super;
......@@ -30,13 +30,13 @@
extern struct command gateway_init;
#define GATEWAY_INIT (&gateway_init.super)
extern struct command_simple gateway_accept;
extern struct command_2 gateway_accept;
#define GATEWAY_ACCEPT (&gateway_accept.super.super)
struct command *
make_gateway_setup(struct command *listen);
extern struct command_simple gateway_setup_command;
#define GATEWAY_SETUP (&gateway_setup_command.super.super)
extern struct command gateway_setup_command;
#define GATEWAY_SETUP (&gateway_setup_command.super)
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