Commit 4167debe authored by Niels Möller's avatar Niels Möller
Browse files

Added handler for unimplemented packet types.

Rev: src/connection.c:1.2
Rev: src/connection.h:1.2
parent 847942db
......@@ -4,6 +4,8 @@
#include "connection.h"
#include "xalloc.h"
#include "ssh.h"
#include "format.h"
struct ssh_connection *ssh_connection_alloc()
{
......@@ -15,3 +17,27 @@ struct ssh_connection *ssh_connection_alloc()
return connection;
}
static int handle_unimplemented(struct abstract_write **w,
struct lsh_string *packet)
{
struct abstract_write_pipe *closure = (struct abstract_write_pipe *) *w;
return A_WRITE(closure->next,
ssh_format("%c%i",
SSH_MSG_UNIMPLEMENTED,
packet->sequence_number));
}
struct abstract_write *make_unimplemented(struct abstract_write *w)
{
struct abstract_write_pipe *res = xalloc(sizeof(struct abstract_write_pipe));
res->super.write = handle_unimplemented;
res->next = w;
return &res->super;
}
......@@ -6,6 +6,7 @@
#define LSH_CONNECTION_H_INCLUDED
#include "lsh_types.h"
#include "abstract_io.h"
struct ssh_connection
{
......@@ -24,4 +25,14 @@ struct ssh_connection
struct ssh_connection *ssh_connection_alloc();
struct connection_closure
{
struct abstract_write super;
struct connection *connection;
};
#if 0
struct abstract_write *make_unimplemented(struct connection *c);
#endif
#endif /* LSH_CONNECTION_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