Commit 68fbf637 authored by Niels Möller's avatar Niels Möller
Browse files

New files

Rev: src/packet_disconnect.c:1.1
Rev: src/packet_disconnect.h:1.1
Rev: src/packet_ignore.c:1.1
Rev: src/packet_ignore.h:1.1
parent 8f898fd8
/* packet_disconnect.c
*
*/
#include "packet_disconnect.h"
#include "parse.h"
#include "ssh.h"
#include "xalloc.h"
static int do_disconnect(struct packet_handler *closure,
struct ssh_connection *connection,
struct lsh_string *packet)
{
struct simple_buffer buffer;
UINT8 msg;
UINT32 length;
UINT32 reason;
UINT8 *start;
simple_buffer_init(&buffer, packet->length, packet->data);
if (parse_uint8(&buffer, &msg)
&& (msg != SSH_MSG_DISCONNECT)
&& (parse_uint32(&buffer, &reason))
&& (parse_string(&buffer, &length, &start))
/* FIXME: Language tag is ignored */ )
{
/* FIXME: Display message */
}
lsh_string_free(packet);
/* FIXME: Mark the file as closed, somehow (probably a variable in
* the write buffer) */
return WRITE_CLOSED;
}
struct packet_handler *make_disconnect_handler()
{
struct packet_handler *res = xalloc(sizeof(struct packet_handler));
res->handler = do_disconnect;
return res;
}
/* packet_disconnect.h
*
*/
#ifndef LSH_PACKET_DISCONNECT_H_INCLUDED
#define LSH_PACKET_DISCONNECT_H_INCLUDED
#include "connection.h"
struct packet_handler *make_disconnect_handler();
#endif /* LSH_PACKET_DISCONNECT_H_INCLUDED */
/* packet_ignore.c
*
*/
#include "packet_ignore.h"
#include "xalloc.h"
static int do_ignore(struct packet_handler *closure,
struct ssh_connection *connection,
struct lsh_string *packet)
{
lsh_string_free(packet);
return WRITE_OK;
}
struct packet_handler *make_ignore_handler(struct packet_handler *closure,
struct ssh_connection *connection,
struct lsh_string *packet)
{
struct packet_handler *res = xalloc(sizeof(struct packet_handler));
res->handler = do_ignore;
return res;
}
/* packet_ignore.h
*
*/
#ifndef LSH_PACKET_IGNORE_H_INCLUDED
#define LSH_PACKET_IGNORE_H_INCLUDED
#include "connection.h"
struct packet_handler *make_ignore_handler();
#endif /* LSH_PACKET_IGNORE_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