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

Re: libsshpp


oh, i just make "git pull" and find out lot's of updates in libsshpp.
that's great.

I like this code, in fact, i have something like this except error
handling (but i use my own system at this moment, so for general
library exceptions may be better, i think).

But i have two suggestions:
1) exceptions in library. I agree, that exceptions is a very powerful
feature in c++, but it's very dangerous in fact. Especially, if you
are working with "module" structure and dynamic libraries. For
example, Google rejected exceptions in their source code (
http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml#Exceptions
). So, may be it's possible to make exceptions an optional feature?

Another way to handle errors: define constants in sshpp namespace,
which defines global (for sshpp) error codes. And simple function to
get a brief description of given error code. And for every function 0
will be "correct result" and nonzero value means error code (global
for any function in sshpp)

2) Connection class. In my architecture i make multiply connection
classes. All connections are created in session, but when connection
is created - it's already has "a speсialization". For example,
ssh.createShell(channel) creates channel and store it to channel
variable. (witch is pointer in my wrapper, but it doesn't matter) .
ssh.exec(cmd, channel) creates a channel, request exec and if all is
ok, stores it into channel variable.

All channel types have different classes, so, they have different
functionality. Why do i need this? Because, for shell channel as a
rule i need "wait for prompt" functionality: channel.waitFor("Some
prompt", timeout, cmd_response);. And if i'm working with shell
channel i need to cut prompt and duplicate output (which means, that
if i enter command, then ssh duplicates it to output and i need to cut
it from response).

In other channel types I don't need any of this. So, may be it's
reasonable to make different classes for different channel types and
create a channel already with it type in ssh.

p.s. waitFor functionality exists in net7ssh library:
http://www.netsieben.com/products/ssh/index.phtml

On Tue, Feb 16, 2010 at 1:40 PM, Aris Adamantiadis <aris@xxxxxxxxxxxx> wrote:
> Hi Stephan,
>
> I am currently working on an official C++ wrapper. It will be available
> with 0.5. There's currently a stub in git master, but it is subject to
> change before release.
> If you have ideas on how to integrate better with C++ (Exceptions,
> streams), you're welcome.
> I'd like for instance being able to provide ostream and istream
> instances for the different streams in a channel.
>
> Thanks,
>
> Aris
>
> Stephan Kountso a écrit :
>> Found include/libssh/libsshpp.hpp file in 0.4 version of libssh. Does
>> this mean, that in the future there will be official c++ wrapper over
>> the libssh?
>>
>> Is there already any code around this project?
>>
>> I'm interested in it, because i need it and at this moment. And I
>> wrote my own small wrapper with only needed functionality.
>>
>
>
>



-- 
С уважением,
Кунцьо Степан aka StepLg

References:
libsshppStephan Kountso <steplg@xxxxxxxxx>
Re: libsshppAris Adamantiadis <aris@xxxxxxxxxxxx>
Archive administrator: postmaster@lists.cynapses.org