cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Question on function layout, libssh2

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Fri, 13 Oct 2006 23:07:45 +0200 (CEST)

On Fri, 13 Oct 2006, James Housley wrote:

> I have 3 basic functions Curl_sftp_connect(), Curl_sftp() and
> Curl_sftp_done()
>
> Curl_sftp_connect() does the initial connection and authentications.
>
> Curl_sftp_done() does cleanup to close it down.
>
> Curl_sftp_connect():
> * In here I should open the remote file with the right mode?
> * Call Curl_Transfer()?

Not exactly. See below.

> To help reduce these questions, is there a document that I missed the the
> architecture for the internals?

There is one (rather outdated) in docs/INTERNALS.

The basic concept is that each protocol has two pairs of functions:

1 - connect/disconnect that deal with protocol-stuff that needs to be done
immediately after TCP connect is done and immediately before TCP disconnect is
performed

2 - do/done, that is doing what needs to be done to set up the transfer of a
given file and what needs to be done after the transfer is complete

The actual tranfer is setup with Curl_Transfer(), but do note that this
function is called Curl_setup_transfer() now in CVS and you really should base
your work on the CVS version and not any release version...

But as you shall see, lots of stuff within libcurl aren't as separated and
clean as they should be. We really don't add protocols that often so we
haven't yet learned how to make the architecture streamlined for it.

-- 
  Commercial curl and libcurl Technical Support: http://haxx.se/curl.html
Received on 2006-10-13