Commit 59ea09c9 authored by Niels Möller's avatar Niels Möller
Browse files

* src/connection.h (DEFINE_PACKET_HANDLER): New macro.

(ssh_connection): Deleted the "share handler" attributes ignore,
unimplemented, fail.
Declare corresponding static handlers .

Rev: src/connection.h:1.56
parent 3200efe1
...@@ -50,6 +50,21 @@ ...@@ -50,6 +50,21 @@
#define HANDLE_PACKET(closure, connection, packet) \ #define HANDLE_PACKET(closure, connection, packet) \
((closure)->handler((closure), (connection), (packet))) ((closure)->handler((closure), (connection), (packet)))
#define DEFINE_PACKET_HANDLER(SPEC, NAME, CARG, PARG) \
static void \
do_##NAME(struct packet_handler *, \
struct ssh_connection *, \
struct lsh_string *); \
\
SPEC struct packet_handler NAME = \
{ STATIC_HEADER, do_##NAME }; \
\
static void \
do_##NAME(struct packet_handler *s UNUSED, \
struct ssh_connection *CARG, \
struct lsh_string *PARG)
/* NOTE: These are used both for indexing the two-element arrays in /* NOTE: These are used both for indexing the two-element arrays in
* the connection object. But they are also used in the flags field, * the connection object. But they are also used in the flags field,
* to indicate our role in the protocol. * to indicate our role in the protocol.
...@@ -114,7 +129,7 @@ ...@@ -114,7 +129,7 @@
; user authentication has been performed. ; user authentication has been performed.
(user object lsh_user) (user object lsh_user)
; the chained connection in the proxy ; The chained connection in the proxy, or gateway.
(chain object ssh_connection) (chain object ssh_connection)
; Cleanup ; Cleanup
...@@ -164,10 +179,11 @@ ...@@ -164,10 +179,11 @@
; Table of all opened channels ; Table of all opened channels
(table object channel_table) (table object channel_table)
; Shared handlers ;; ; Shared handlers
(ignore object packet_handler) ;; (ignore object packet_handler)
(unimplemented object packet_handler) ;; (unimplemented object packet_handler)
(fail object packet_handler) ;; (fail object packet_handler)
;; (forward object packet_handler)
; (provides_privacy . int) ; (provides_privacy . int)
; (provides_integrity . int) ; (provides_integrity . int)
...@@ -200,4 +216,10 @@ void connection_unlock(struct ssh_connection *self); ...@@ -200,4 +216,10 @@ void connection_unlock(struct ssh_connection *self);
/* Table of packet types */ /* Table of packet types */
extern const char *packet_types[0x100]; extern const char *packet_types[0x100];
/* Simple packet handlers. */
extern struct packet_handler connection_ignore_handler;
extern struct packet_handler connection_unimplemented_handler;
extern struct packet_handler connection_fail_handler;
extern struct packet_handler connection_forward_handler;
#endif /* LSH_CONNECTION_H_INCLUDED */ #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