channel_commands.h 4.19 KB
Newer Older
Niels Möller's avatar
Niels Möller committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
/* channel_commands.h
 *
 * $Id$
 */

/* lsh, an implementation of the ssh protocol
 *
 * Copyright (C) 1998 Niels Möller
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License as
 * published by the Free Software Foundation; either version 2 of the
 * License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

25
26
27
#ifndef LSH_CHANNEL_COMMANDS_H_INCLUDED
#define LSH_CHANNEL_COMMANDS_H_INCLUDED

Niels Möller's avatar
Niels Möller committed
28
29
30
31
32
33
34
#include "channel.h"

#define GABA_DECLARE
#include "channel_commands.h.x"
#undef GABA_DECLARE

/* Command to open a new channel. Takes a connection as argument
Niels Möller's avatar
Niels Möller committed
35
36
 * returns a new channel. Raises an EXC_CHANNEL_OPEN exception on
 * error. */
Niels Möller's avatar
Niels Möller committed
37
38
39
40
41
42

/* GABA:
   (class
     (name channel_open_command)
     (super command)
     (vars
43
44
45
       ; This method should return a partially filled in channel,
       ; and create a channel open request by calling
       ; prepare_channel_open.
46
47
       (new_channel method "struct ssh_channel *"
                    "struct ssh_connection *connection"
48
                    "UINT32 local_channel_number"
Niels Möller's avatar
Niels Möller committed
49
50
51
                    "struct lsh_string **request")))
*/

52
#define NEW_CHANNEL(s, c, n, r) ((s)->new_channel((s), (c), (n), (r)))
Niels Möller's avatar
Niels Möller committed
53

Niels Möller's avatar
Niels Möller committed
54
void do_channel_open_command(struct command *s,
Niels Möller's avatar
Niels Möller committed
55
			    struct lsh_object *x,
56
57
			    struct command_continuation *c,
			    struct exception_handler *e);
58

Niels Möller's avatar
Niels Möller committed
59
60
/* Takes a channel as argument, and returns the same channel. Raises
 * an exception on error. FIXME: Which exception??? */
61
62
63
64
65
/* GABA:
   (class
     (name channel_request_command)
     (super command)
     (vars
66
67
68
       ; This method should return a formatted request. The
       ; want_reply field in the request should be non_zero iff *c is
       ; non-NULL on return.  
69
70
       (format_request method "struct lsh_string *"
                       "struct ssh_channel *channel"
71
		       "struct command_continuation **c")))
72
73
74
75
76
*/

#define FORMAT_CHANNEL_REQUEST(r, c, w) \
((r)->format_request((r), (c), (w)))

Niels Möller's avatar
Niels Möller committed
77
void do_channel_request_command(struct command *s,
78
			       struct lsh_object *x,
79
80
			       struct command_continuation *c,
			       struct exception_handler *e);
81
82
83
84
85
86
87
88
89
90
91

/* GABA:
   (class
     (name global_request_command)
     (super command)
     (vars
       (format_request method "struct lsh_string *"
                       "struct ssh_connection *connection"
		       "struct command_continuation **c")))
*/

92
#define FORMAT_GLOBAL_REQUEST(r, conn, c) \
93
94
((r)->format_request((r), (conn), (c)))

Niels Möller's avatar
Niels Möller committed
95

Niels Möller's avatar
Niels Möller committed
96
97
98
99
void do_channel_global_command(struct command *s,
			       struct lsh_object *x,
			       struct command_continuation *c,
			       struct exception_handler *e);
100

101
102
103
104
105
106
107
108
109
struct command *
make_install_global_request_handler(UINT32 name,
				    struct global_request *handler);

/* Takes a connection and a handler as arguments, and installs the
 * handler. */
/* GABA:
   (class
     (name install_info)
110
     (super command_2)
111
     (vars
112
       (name . int)))
113
114
*/

115
116
117
118
119
120
121
122
123
124
125
126
void
do_install_global_request_handler(struct command_2 *s,
				  struct lsh_object *a1,
				  struct lsh_object *a2,
				  struct command_continuation *c,
				  struct exception_handler *e);
void
do_install_channel_open_handler(struct command_2 *s,
				struct lsh_object *a1,
				struct lsh_object *a2,
				struct command_continuation *c,
				struct exception_handler *e);
127
128

#define STATIC_INSTALL_GLOBAL_HANDLER(atom) \
129
{ { { STATIC_HEADER, do_command_2 }, do_install_global_request_handler }, atom }
130
131

#define STATIC_INSTALL_OPEN_HANDLER(atom) \
132
{ { { STATIC_HEADER, do_command_2 }, do_install_channel_open_handler }, atom }
133
134
135
136
137
138
139
140
141

struct command *
make_install_fix_global_request_handler(UINT32 name,
					struct global_request *handler);

struct command *
make_install_fix_channel_open_handler(UINT32 name,
				      struct channel_open *handler);

142
#endif /* LSH_CHANNEL_COMMANDS_H_INCLUDED */