Balazs Scheidler <[EMAIL PROTECTED]> writes:
> I am looking into implementing client requests when the connection protocol
> is up and running. (e.g. request opening a channel, a pty and a shell)
That would be good. I have done some of the needed work, but some more
is needed before the lsh client can work again. As soon as the client
works again, I'll create a new snapshot
> As I understand I should derive different classes from
> channel_request_command, and use the format_request method to generate a
> request to be sent. This is where I found some inconsistency:
>
> Here's the declaration of channel_request_command:
>
> /* GABA:
> (class
> (name channel_request_command)
> (super command)
> (vars
> ;; 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.
> (format_request method "struct lsh_string *"
> "struct ssh_channel *channel"
> "struct command_continuation **c")))
> */
The inconsistence is because I realized that I wanted the format
method for pty requests to be able to insert a continuation frame of
its own, with enough information to set the tty to raw mode if the
pty-request was successful. From the latest ChangeLog:
Sun Apr 18 23:03:20 1999 Niels Möller <[EMAIL PROTECTED]>
* src/channel_commands.h (channel_request_command): Pass a pointer
to a pointer to the command's continuation as an argument. This
replaces the want_reply argument, and it also makes it possible
for the command to add a new continuation which is invoked when
the peers response is received.
It seems that I have some local changes that I haven't checked in yet.
I'm committing them now, even though I'm not sure about their shape. I
also tried to move the client-side pty handling into client_pty.c, and
I added a new builtin progn command; it takes a list of commands as
argument, and returns a new command. When the command is called with
an argument, it invokes all the commands in the list in parallel,
and returns the value of the last command (the rest of the values are
discarded). Look at lsh.c, client_pty.c and command.c.
This can be used in lsh.c like
/* GABA:
(expr
(name make_client_connect)
(globals
(connect connect_command)
(progn "&progn_command->super"))
(params
(connect object command)
(handshake object command)
(userauth_service object command)
(login object command)
(requests object object_list))
(expr (lambda (port)
((progn requests) (open_session (login (userauth_service
(handshake (connect port)))))))))
*/
where request is an object list containing commands to request a pty
and start a shell, etc. All the commands should accept the channel as
argument.
Hapy hacking.