Subject: Re: [libssh2] userauth_keyboard_interactive problem

Re: [libssh2] userauth_keyboard_interactive problem

From: Paul Thomas <thomaspu_at_gmail.com>
Date: Sat, 15 Dec 2007 18:44:53 -0500

Whoa. Ok, I think I understand this better now.

So inside my C++ class that is wrapping up the library, I use the
"abstract" parameter as a data storage object:
  mp_session = libssh2_session_init_ex(NULL, NULL, NULL, this);

and then when I give the library my static member function, inside
that member function I can do something like this:

SSHConnection* this_ = static_cast<SSHConnection *>(*abstract);

And now I have a valid this_ pointer to the original object ;p

I think this solves my problem quite well
Paul

On Dec 15, 2007 6:32 PM, Dan Fandrich <dan_at_coneharvesters.com> wrote:
> On Sat, Dec 15, 2007 at 05:57:20PM -0500, Paul Thomas wrote:
> > I'm completely lost as to how I could "store an array of functors for
> > objects using libssh2". Is this some undocumented part of the library?
> > Would I somehow tell the library about my object's address?
>
> As someone else has already pointed out here, you don't actually need
> this step. You can pass in to libssh2 a pointer (in your case, it would
> be to your libssh2 wrapper object) directly which you can access from
> the callback function to gain access to your object.
>
> If that option weren't available, you could use the technique I mentioned.
> Essentially, you create your own static mapping between libssh2 session
> pointers and libssh2-using C++ objects before starting the transfer.
> Your callback is passed the libssh2 session pointer which you would use
> to look up the appropriate C++ object. A functor is a convenient way to
> pass from the C to C++ worlds.
>
>
> >>> Dan
> --
> http://www.MoveAnnouncer.com The web change of address service
> Let webmasters know that your web site has moved
>
> -------------------------------------------------------------------------
> SF.Net email is sponsored by:
> Check out the new SourceForge.net Marketplace.
> It's the best place to buy or sell services
> for just about anything Open Source.
> http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
> _______________________________________________
> libssh2-devel mailing list
> libssh2-devel_at_lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/libssh2-devel
>

-------------------------------------------------------------------------
SF.Net email is sponsored by:
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services
for just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
libssh2-devel mailing list
libssh2-devel_at_lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libssh2-devel
Received on 2007-12-16