Commit 897758c1 authored by Niels Möller's avatar Niels Möller
Browse files

* src/debug.c (do_rec_debug): Replace with a definition that uses

DEFINE_PACKET_HANDLER.

Rev: src/debug.c:1.34
Rev: src/debug.h:1.15
parent c53c6811
...@@ -77,7 +77,9 @@ make_packet_debug(struct abstract_write *next, ...@@ -77,7 +77,9 @@ make_packet_debug(struct abstract_write *next,
return &closure->super.super; return &closure->super.super;
} }
static struct lsh_string *make_debug_packet(const char *msg, int always_display)
static struct lsh_string *
make_debug_packet(const char *msg, int always_display)
{ {
return ssh_format("%c%c%z%z", return ssh_format("%c%c%z%z",
SSH_MSG_DEBUG, SSH_MSG_DEBUG,
...@@ -88,27 +90,27 @@ static struct lsh_string *make_debug_packet(const char *msg, int always_display) ...@@ -88,27 +90,27 @@ static struct lsh_string *make_debug_packet(const char *msg, int always_display)
} }
/* Send a debug message to the other end. */ /* Send a debug message to the other end. */
void send_debug_message(struct abstract_write *write, const char *msg, int always_display) void
send_debug_message(struct abstract_write *write, const char *msg, int always_display)
{ {
A_WRITE(write, make_debug_packet(msg, always_display)); A_WRITE(write, make_debug_packet(msg, always_display));
} }
void send_debug(struct abstract_write *write, const char *msg, int always_display) void
send_debug(struct abstract_write *write, const char *msg, int always_display)
{ {
if (debug_flag) if (debug_flag)
send_debug_message(write, msg, always_display); send_debug_message(write, msg, always_display);
} }
void send_verbose(struct abstract_write *write, const char *msg, int always_display) void
send_verbose(struct abstract_write *write, const char *msg, int always_display)
{ {
if (verbose_flag) if (verbose_flag)
send_debug_message(write, msg, always_display); send_debug_message(write, msg, always_display);
} }
static void DEFINE_PACKET_HANDLER(, connection_debug_handler, connection UNUSED, packet)
do_rec_debug(struct packet_handler *self UNUSED,
struct ssh_connection *connection UNUSED,
struct lsh_string *packet)
{ {
struct simple_buffer buffer; struct simple_buffer buffer;
unsigned msg_number; unsigned msg_number;
...@@ -140,12 +142,3 @@ do_rec_debug(struct packet_handler *self UNUSED, ...@@ -140,12 +142,3 @@ do_rec_debug(struct packet_handler *self UNUSED,
lsh_string_free(packet); lsh_string_free(packet);
} }
} }
struct packet_handler *make_rec_debug_handler(void)
{
NEW(packet_handler, self);
self->handler = do_rec_debug;
return self;
}
...@@ -38,6 +38,6 @@ void send_debug_message(struct abstract_write *write, const char *msg, int alway ...@@ -38,6 +38,6 @@ void send_debug_message(struct abstract_write *write, const char *msg, int alway
void send_debug(struct abstract_write *write, const char *msg, int always_display); void send_debug(struct abstract_write *write, const char *msg, int always_display);
void send_verbose(struct abstract_write *write, const char *msg, int always_display); void send_verbose(struct abstract_write *write, const char *msg, int always_display);
struct packet_handler *make_rec_debug_handler(void); extern struct packet_handler connection_debug_handler;
#endif /* LSH_DEBUG_H_INCLUDED */ #endif /* LSH_DEBUG_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