guile-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [RFC] Guile-SSH channels improvement


From: Nala Ginrut
Subject: Re: [RFC] Guile-SSH channels improvement
Date: Fri, 24 Jan 2014 17:47:32 +0800

On Fri, 2014-01-24 at 12:47 +0400, Artyom Poptsov wrote:
> Hi all,
> 
> as you might know I'm working on Guile-SSH library [1] that is aimed to
> provide SSH protocol support for Scheme programs.  One of the data types
> provided by the library is a Guile-SSH channel which can be used for
> transferring data between SSH client/server.
> 

Nice work!

> Currently channels are implemented as simple smobs and Guile-SSH
> provides a bunch of special procedures for reading/writing data.  The
> problem is that the current implementation allows only to transfer
> Scheme strings through channels.  Obviously that is very limiting
> because it's often needed to transfer arbitrary data, not only strings.
> 
> My goal is to improve Guile-SSH channels implementation so it will
> handle any kinds of Scheme data types.  So here is my RFC.
> 
> Ludovic Courtès proposed to use bytevectors for reading/writing of data
> as improvement to the current implementation and he sent me a patch that
> changes `channel-read' procedure so now it returns read data as a
> bytevector.  `examples/sssh.scm' updated as well.  The patch was applied
> on this branch:
>   
> https://github.com/artyom-poptsov/libguile-ssh/tree/channel-io-improvement-with-bytevectors
> 

Yes, bytevector would be better, since Guile2 uses character-string
rather than byte-string which is similar to string in C. 

> Meanwhile I've re-implemented Guile-SSH channels using GNU Guile port
> API. [2] The work is done on `channel-to-ptob' branch:
>   https://github.com/artyom-poptsov/libguile-ssh/tree/channel-to-ptob
> 
> As a consequence of using port API the most of specific procedures for
> dealing with channels such as `channel-read', `channel-write',

Agreed. Port is convenient to use. And it's nice to handle ports with
unified functions like read/write.

> `channel-close' and friends are eliminated, so the API became clearer.
> 
> I've write a SSH-based echo protocol implementation that uses Guile-SSH
> to demostrate new API usage:
>   
> https://github.com/artyom-poptsov/libguile-ssh/tree/channel-to-ptob/examples/echo
> 
> Tests with transferring of u8 vectors have shown that implemented ports
> works nicely.
> 
> I'm going to merge changes from `channel-to-ptob' branch for the next
> Guile-SSH 0.5.0 release if no one has objections on it.  Of course,
> any comments are welcome.
> 
> Thanks.
> 
> - Artyom
> 
> [1] https://github.com/artyom-poptsov/libguile-ssh
> [2] 
> https://www.gnu.org/software/guile/docs/docs-1.8/guile-ref/I_002fO-Extensions.html
> 





reply via email to

[Prev in Thread] Current Thread [Next in Thread]