connection.c 1.19 KB
Newer Older
1
2
3
4
5
6
/* connection.c
 *
 */

#include "connection.h"
#include "xalloc.h"
7
8
#include "ssh.h"
#include "format.h"
9

10
11
static int handle_connection(struct abstract_write **w,
			     struct lsh_String *packet)
12
{
13
14
15
16
17
  struct ssh_connection *closure = (struct ssh_connection *) *w;

  /* First handle special messages: debug, ignore, disconnect, ... */

  /* Next see if we are expecting a newkey message */
18

19
20
21
22
23
24
25
26
  /* Dispatch by packet type, and later by channel number */

  
}

struct abstract_write *make_ssh_connection()
{
  struct ssh_connection *connection = xalloc(sizeof(struct ssh_connection));
27

28
  connection->super.write = handle_connection;
29
30
31
32
  connection->max_packet = 0x8000;

  return connection;
}
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56

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;
}