Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to use libssh embedded in foxpro application?

Status
Not open for further replies.

mariusmutu

Technical User
Feb 14, 2007
2
RO
Hello,
I want to use ssh embedded in my client-server applications, so that I secure the connections to the databasess through ssh tunnels.

I installed libssh from and I have "ssh.dll" in C:\Program Files\libssh\bin
I think it is a C dll and I don't know if I can use it directly.

Does anyone have experience with libssh? Or with other embedded ssh client solutions?

Thank you
 
I have used stunnel, I don't remember but could look up how I did it.

In general in cas of C dlls like this or eg zlib.dll, you need definitions of functions, their name and parametertypes to use DECLARE DLL to declare and then use the functions in VFP, the same way you use kernel32.dll or other WinAPI DLL functions in VFP.

So can you point us to the site, acompanying documentation etc, so we may deduct the needed DECLAREs?

Bye, Olaf.
 
Sorry, you point to the site already. There are a lot of functions to declare, find out out what you need to be able to use for your overall task.

I thinks it's not impossible but quite unlikely you'll find someone here having the full list of DECLAREs for this specific DLL.

If someone has more time than me, here's a starting point for list of modules, drill down the list of functions in the modules and see what you need:


Bye, Olaf.
 
Hello Olaf,
Thank you for taking the time to answer me.
I want to use the tunneling part, like in this example ( )

Code:
int direct_forwarding(ssh_session session)
{
  ssh_channel forwarding_channel;
  int rc;
  char *http_get = "GET / HTTP/1.1\nHost: [URL unfurl="true"]www.google.com\n\n";[/URL]
  int nbytes, nwritten;
  forwarding_channel = ssh_channel_new(session);
  if (rc != SSH_OK) return rc;
  rc = channel_open_forward(forwarding_channel,
                            "[URL unfurl="true"]www.google.com",[/URL] 80,
                            "localhost", 5555);
  if (rc != SSH_OK)
  {
    ssh_channel_free(forwarding_channel);
    return rc;
  }
  nbytes = strlen(http_get);
  nwritten = channel_write(forwarding_channel, http_get, nbytes);
  if (nbytes != nwritten)
  {
    ssh_channel_free(forwarding_channel);
    return SSH_ERROR;
  }
  ...
  ssh_channel_free(forwarding_channel);
  return SSH_OK;
}

I think I need the declarations for:
Code:
ssh_session = ssh_new();
forwarding_channel = ssh_channel_new(session)
rc = channel_open_forward(forwarding_channel, "[URL unfurl="true"]www.google.com",[/URL] 80, "localhost", 5555);
ssh_channel_free(forwarding_channel);
ssh_free(my_ssh_session);

I will also look into stunnel.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top